.mx-language-selector-host {
  display: inline-flex;
  align-items: center;
  width: 2.55rem;
  height: 2.55rem;
  flex: 0 0 auto;
  max-width: 100%;
  position: relative;
  z-index: 20;
  contain: layout;
}

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

.mx-language-picker { position: relative; }
.mx-language-picker > summary {
  display: grid;
  place-items: center;
  width: 2.55rem;
  height: 2.55rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 999px;
  background: rgba(7, 16, 19, .86);
  color: #fff;
  cursor: pointer;
  list-style: none;
  font-size: 1.15rem;
  line-height: 1;
}
.mx-language-picker > summary::-webkit-details-marker { display: none; }
.mx-language-picker > summary:focus-visible { outline: 3px solid rgba(255, 225, 82, .56); outline-offset: 2px; }
.mx-language-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + .5rem);
  min-width: 12rem;
  padding: .4rem;
  border: 1px solid #dce3ed;
  border-radius: 13px;
  background: #fff;
  color: #17233d;
  box-shadow: 0 18px 45px rgba(17, 25, 54, .2);
}
.mx-language-picker[open] > .mx-language-menu { display: grid; gap: .15rem; }
.mx-language-menu button {
  display: grid;
  grid-template-columns: 1.6rem 1fr;
  align-items: center;
  gap: .45rem;
  width: 100%;
  min-height: 2.55rem;
  padding: .5rem .65rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.mx-language-menu button:hover,
.mx-language-menu button[aria-checked="true"] { background: #f0ecff; }
.mx-language-menu button:focus-visible { outline: 2px solid #6f35e8; outline-offset: -2px; }

html[data-meteox-i18n-pending="true"] body > * { visibility: hidden !important; }
html[data-meteox-i18n-pending="true"] body::before {
  content: "";
  visibility: visible;
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  background: #071013 radial-gradient(circle at 50% 42%, rgba(111, 53, 232, .24), transparent 28%);
}
html[data-meteox-i18n-pending="true"] body::after {
  content: "M";
  visibility: visible;
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 2147483647;
  display: grid;
  place-items: center;
  width: 3.2rem;
  height: 3.2rem;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 1rem;
  background: #6f35e8;
  color: #fff;
  font: 900 1.35rem/1 system-ui, sans-serif;
  transform: translate(-50%, -50%);
}

.mx-language-selector-label {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-width: 0;
  margin: 0;
  color: inherit;
  font: inherit;
}

.mx-language-selector-label > span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mx-language-selector {
  box-sizing: border-box;
  min-width: 7.5rem;
  max-width: 100%;
  min-height: 2.5rem;
  padding: .48rem 2rem .48rem .72rem;
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 999px;
  background: rgba(7, 16, 19, .86);
  color: #fff;
  font: inherit;
  font-size: .875rem;
  font-weight: 750;
  line-height: 1.2;
  text-overflow: ellipsis;
  touch-action: manipulation;
  -webkit-appearance: menulist;
  appearance: auto;
}

.mx-language-selector:focus-visible {
  outline: 3px solid rgba(255, 225, 82, .56);
  outline-offset: 2px;
}

.mx-i18n-legal-notice {
  box-sizing: border-box;
  width: min(1120px, calc(100% - 2rem));
  margin: 1rem auto;
  padding: .9rem 1rem;
  border: 1px solid rgba(255, 193, 7, .48);
  border-radius: 14px;
  background: rgba(255, 193, 7, .1);
  color: inherit;
  line-height: 1.45;
}

.mx-i18n-legal-notice strong,
.mx-i18n-legal-notice span {
  display: block;
  overflow-wrap: anywhere;
}

.mx-i18n-legal-notice strong { margin-bottom: .3rem; }

html[lang="de"] button,
html[lang="de"] .button,
html[lang="de"] .btn,
html[lang="de"] nav a,
html[lang="ko"] button,
html[lang="ko"] .button,
html[lang="ko"] .btn,
html[lang="ko"] nav a {
  white-space: normal;
  text-wrap: balance;
}

html[data-meteox-i18n-ready="true"],
html[data-meteox-i18n-ready="true"] body {
  max-width: 100%;
  overflow-x: clip;
}

/* Translated grid children must be allowed to shrink below their English
   min-content width. This is especially important for German compound words
   on a 390 px viewport. */
html[data-meteox-i18n-ready="true"] .hero-grid > *,
html[data-meteox-i18n-ready="true"] .mx-auto-grid > * {
  min-width: 0;
  max-width: 100%;
}

html[data-meteox-i18n-ready="true"] .btn,
html[data-meteox-i18n-ready="true"] .button,
html[data-meteox-i18n-ready="true"] [data-primary-action] {
  max-width: 100%;
  overflow-wrap: anywhere;
}

@media (max-width: 1024px) {
  .mx-language-selector { min-width: 7rem; }
}

/* The public mobile drawer is the selector's only home on narrow screens.
   Keep it compact and anchored instead of allowing the desktop navigation gap
   or a body-level fallback to turn the picker into an orphaned overlay. */
@media (max-width: 900px) {
  .nav-shell [data-nav] {
    gap: .38rem;
    padding: .7rem;
    max-width: calc(100vw - 1rem - env(safe-area-inset-left) - env(safe-area-inset-right));
  }

  .nav-shell [data-nav] > a,
  .nav-shell [data-nav] > .btn {
    min-height: 2.35rem;
    display: flex;
    align-items: center;
  }

  .nav-shell [data-nav] > .mx-language-selector-host {
    order: -1;
    align-self: flex-end;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    margin: 0 0 .15rem;
  }

  .nav-shell [data-nav] .mx-language-picker > summary {
    width: 2.75rem;
    height: 2.75rem;
  }

  .nav-shell [data-nav] .mx-language-menu {
    top: calc(100% + .4rem);
    right: 0;
    left: auto;
    width: min(12rem, calc(100vw - 2rem - env(safe-area-inset-left) - env(safe-area-inset-right)));
    min-width: 0;
    max-height: min(18rem, calc(100dvh - 8rem - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .nav-shell [data-nav] .mx-language-menu button {
    min-height: 2.35rem;
    padding: .42rem .55rem;
  }

  /* The approved public header uses .launch-head rather than .nav-shell.
     Anchor its sole mobile picker inward from the drawer's left edge so the
     12rem menu fits even at 320px instead of extending off-screen. */
  .launch-head [data-nav] > .mx-language-selector-host {
    order: -1;
    align-self: flex-start;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    margin: 0 0 .15rem;
  }

  .launch-head [data-nav] .mx-language-menu {
    right: auto;
    left: 0;
    width: min(12rem, calc(100vw - 2rem - env(safe-area-inset-left) - env(safe-area-inset-right)));
    min-width: 0;
    max-height: min(18rem, calc(100dvh - 8rem - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

@media (max-width: 700px) {
  .mx-language-selector-host { width: auto; padding: .25rem 0; }

  .app-topbar .mx-language-selector-host,
  .app-topbar .mx-language-selector-label {
    width: auto;
    padding: 0;
  }

  .app-topbar .mx-language-picker > summary { width: 2.75rem; height: 2.75rem; }

  body > .mx-language-selector-host {
    position: fixed;
    top: max(.5rem, env(safe-area-inset-top));
    right: max(.5rem, env(safe-area-inset-right));
    width: auto;
    z-index: 2147482000;
  }

  /* A selector inside either canonical header must never also behave like the
     emergency body-level fallback. */
  .nav-shell [data-nav] > .mx-language-selector-host,
  .app-topbar .mx-language-selector-host {
    position: relative;
    inset: auto;
  }
}

/* The authenticated top bar keeps account, notification, and lock controls
   visible on small WebKit viewports. Native select intrinsic sizing can ignore
   a percentage max-width, so pin only this compact closed control below 400px.
   The expanded picker still exposes every full localized language label. */
@media (max-width: 400px) {
  .app-topbar .top-actions {
    min-width: 0;
  }

  .app-topbar .mx-language-selector-host {
    flex: 0 0 2.75rem;
    min-width: 0;
    max-width: 2.75rem;
  }
}
