.theme-language-switch {
  position: relative;
  display: block;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  align-self: center;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
}

.theme-language-trigger {
  display: flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: inherit;
  background: transparent;
  cursor: pointer;
  list-style: none;
  transition: background-color 0.15s ease;
}

.theme-language-trigger::-webkit-details-marker {
  display: none;
}

.theme-language-trigger::marker {
  content: "";
}

.theme-language-trigger > svg {
  width: 20px;
  height: 20px;
}

.theme-language-trigger:hover,
.theme-language-switch[open] > .theme-language-trigger {
  background-color: rgba(128, 128, 128, 0.15);
}

.theme-language-options {
  position: absolute;
  z-index: 60;
  top: calc(100% + 8px);
  right: 0;
  box-sizing: border-box;
  width: 140px;
  padding: 4px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  color: #1f2937;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

/* Leave the native closed details content hidden. */
.theme-language-switch[open] > .theme-language-options {
  display: grid;
  gap: 2px;
}

.theme-language-option {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  color: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.theme-language-option::after {
  width: 16px;
  margin-left: auto;
  content: "";
  text-align: center;
}

.theme-language-option:hover,
.theme-language-option.is-active {
  background-color: rgba(128, 128, 128, 0.12);
}

.theme-language-option.is-active {
  font-weight: 600;
}

.theme-language-option.is-active::after {
  content: "✓";
}

.theme-language-trigger:focus-visible,
.theme-language-option:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.dark .theme-language-options {
  border-color: #374151;
  color: #f3f4f6;
  background: #1f2937;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

@media (max-width: 420px) {
  #header > div {
    gap: 8px;
  }

  #header > div > div:first-child {
    min-width: 0;
    flex-shrink: 1;
  }

  #header > div > div:first-child > a {
    min-width: 0;
    gap: 8px;
  }

}
