.lang-switch {
  position: relative;
  display: inline-block;
}

.lang-switch-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
}

.lang-switch-btn:hover {
  border-color: var(--sage);
}

.lang-switch-btn::after {
  content: "";
  width: 10px;
  height: 10px;
  margin-left: 2px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8578' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  transition: transform .2s ease;
  flex-shrink: 0;
}

.lang-switch.open .lang-switch-btn::after {
  transform: rotate(180deg);
}

.lang-switch-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 170px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: 0 10px 25px rgba(0,0,0,.1);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .18s ease, visibility .18s ease, transform .18s ease;
}

.lang-switch.open .lang-switch-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-switch-option {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 14px;
  font-family: inherit;
  font-size: 13.5px;
  background: none;
  border: none;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}

.lang-switch-option .flag {
  font-size: 15px;
  line-height: 1;
  flex-shrink: 0;
}

.lang-switch-option:hover {
  background: var(--sand);
  color: var(--sage-dark);
}

.lang-switch-option.active {
  background: var(--sand-light);
  font-weight: 700;
  color: var(--sage-dark);
}

@media (prefers-color-scheme: dark) {
  .lang-switch-btn {
    border-color: rgba(255,255,255,.12);
    color: #f5f5f5;
  }
  .lang-switch-menu {
    background: #151515;
    border-color: rgba(255,255,255,.12);
    box-shadow: 0 10px 25px rgba(0,0,0,.4);
  }
  .lang-switch-option {
    color: #f5f5f5;
  }
  .lang-switch-option:hover {
    background: #222;
    color: #fff;
  }
  .lang-switch-option.active {
    background: #1a1a1a;
    color: var(--sage);
  }
}
