.lang-fab {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 9999;
  font-family: inherit;
}

.lang-fab__btn {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid var(--border-light, rgba(255, 255, 255, 0.12));
  background: rgba(2, 6, 23, 0.65);
  color: var(--text-main, #f8fafc);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.lang-fab__btn:hover {
  transform: translateY(-1px);
  background: rgba(2, 6, 23, 0.78);
  border-color: rgba(255, 255, 255, 0.18);
}

.lang-fab__btn:active {
  transform: translateY(0);
}

.lang-fab__btn:focus-visible {
  outline: none;
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.35),
    0 0 0 2px rgba(99, 102, 241, 0.55);
}

.lang-fab__btn svg {
  width: 22px;
  height: 22px;
  display: block;
}

.lang-fab__menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  min-width: 190px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-light, rgba(255, 255, 255, 0.12));
  background: rgba(15, 23, 42, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  display: none;
  /* Allow long language lists to scroll */
  max-height: min(60vh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;

}

.lang-fab[data-open="true"] .lang-fab__menu {
  display: block;
}

.lang-fab__item {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-main, #f8fafc);
  padding: 0.8rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.lang-fab__item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.lang-fab__item:focus-visible {
  outline: none;
  background: rgba(99, 102, 241, 0.18);
}

.lang-fab__label {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
}

.lang-fab__name {
  font-weight: 700;
  line-height: 1.2;
}

.lang-fab__tag {
  color: var(--text-muted, #94a3b8);
  font-size: 0.8rem;
  line-height: 1.1;
}

.lang-fab__check {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.12s ease, transform 0.12s ease;
  color: var(--secondary, #ec4899);
  flex: 0 0 auto;
}

.lang-fab__item.is-active .lang-fab__check {
  opacity: 1;
  transform: scale(1);
}

@media (max-width: 480px) {
  .lang-fab__btn {
    width: 44px;
    height: 44px;
  }
  .lang-fab__menu {
    min-width: 176px;
  }
}

