.language-picker {
  position: relative;
  flex: 0 0 auto;
}

.site-language-menu { margin-inline-start: auto; }

.language-picker > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #9c97bf85;
  border-radius: 10px;
  background: #25223b;
  color: #fff;
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
  font-size: .875rem;
  font-weight: 700;
}

.language-picker > summary::-webkit-details-marker { display: none; }

.language-chevron {
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.language-picker[open] .language-chevron {
  transform: translateY(2px) rotate(225deg);
}

.language-options {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  width: min(340px, calc(100vw - 48px));
  max-height: min(67dvh, 440px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid #9c97bf70;
  border-radius: 12px;
  background: #171629;
  box-shadow: 0 16px 36px #0009;
}

.language-picker:not([open]) .language-options { display: none; }

.language-options a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 5px 7px;
  border-radius: 6px;
  color: #f3efff;
  font-size: .875rem;
  overflow-wrap: anywhere;
}

.language-options a[aria-current="page"],
.language-options a:hover,
.language-picker > summary:hover {
  background: #443561;
}

.language-picker :is(summary, a):focus-visible {
  outline: 2px solid #dacaff;
  outline-offset: -2px;
}

.language-flag {
  display: block;
  flex: 0 0 auto;
  width: 24px;
  height: 18px;
  border-radius: 3px;
  box-shadow: 0 0 0 1px #ffffff3b;
}

@media (max-width: 380px) {
  .language-picker > summary { gap: 6px; padding-inline: 8px; }
  .language-options a { gap: 6px; }
  .language-options .language-flag { width: 20px; height: 15px; }
}
