html.i18n-pending body {
  visibility: hidden;
}

.language-switcher {
  position: absolute;
  z-index: 7;
  top: clamp(12px, 2.4cqh, 24px);
  /* 3 px de marge du groupe + 6 px du bouton : le drapeau lui-même s'aligne sur J1. */
  left: calc(var(--screen-pad) - 9px);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  color: var(--screen-muted, #a8b9b1);
  background: transparent;
  border: 0;
  pointer-events: auto;
  font: 700 0.72rem/1 "Roboto Mono", monospace;
  letter-spacing: 0.06em;
}

/* Reserve a row above the player while keeping the level at the top right. */
.arcade-home-body .arcade-hud-player,
.arcade-home-body .arcade-hud-account > .arcade-hud-pad {
  position: relative;
  top: 52px;
}

/* Le CTA invité se centre face au bloc de gauche (langues puis « J1 / pseudo »). */
.arcade-home-body .arcade-hud-account:not(:has(.arcade-hud-record)) .arcade-hud-login {
  top: 14px;
}

/* Le bloc J1 garde le même repère, avec ou sans niveau de compte à droite. */
@media (min-width: 761px) {
  .arcade-home-body .arcade-hud-account:has(.arcade-hud-record) .arcade-hud-player {
    padding-top: 0;
  }

  .arcade-home-body .arcade-hud-account:has(.arcade-hud-record) > .arcade-hud-pad {
    margin-top: max(0px, calc((clamp(16px, 2.8cqh, 22px) - 18px) / 2));
  }
}

@media (max-width: 760px) {
  .language-switcher {
    top: 10px;
    left: 3px;
  }
}

.language-switcher button {
  appearance: none;
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  padding: 6px;
  color: inherit;
  background: transparent;
  box-shadow: none;
  font: inherit;
  cursor: pointer;
}

.language-flag { display: block; width: 32px; height: 24px; opacity: .55; }

.language-switcher button:is([aria-pressed="true"], :hover, :focus-visible) .language-flag {
  opacity: 1;
}

.language-switcher button:focus-visible {
  outline: 2px dashed var(--screen-mint);
  outline-offset: 2px;
}

.embedded-game-body > .language-switcher,
.embedded-ranking-body > .language-switcher,
.home-demo-body > .language-switcher {
  display: none;
}

.arcade-cabinet:is(.is-panel-open, .is-content-open) .arcade-attract > .language-switcher,
.has-player-profile-open .arcade-attract > .language-switcher {
  display: none;
}
