.portfolio-language-switch {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: 12px;
  z-index: 10000;
  display: inline-flex;
  align-items: center;
}

.portfolio-language-switch--docked {
  position: relative;
  inset: auto;
  z-index: 4;
  flex-shrink: 0;
}

.portfolio-language-switch button {
  min-width: 2.4rem;
  height: 2.2rem;
  min-height: 0;
  padding: 0 0.72rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #5d3f25;
  cursor: pointer;
  font: 700 0.75rem/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.portfolio-language-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: rgba(215, 195, 175, 0.9) !important;
  background: rgba(255, 250, 244, 0.72) !important;
  box-shadow: 0 4px 12px rgba(74, 52, 40, 0.06);
  backdrop-filter: blur(10px);
}

.portfolio-language-options {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  display: none;
  flex-direction: column;
  gap: 4px;
  min-width: 4.8rem;
  padding: 5px;
  border: 1px solid rgba(215, 195, 175, 0.86);
  border-radius: 14px;
  background: rgba(255, 252, 247, 0.98);
  box-shadow: 0 14px 32px rgba(48, 32, 18, 0.13);
  backdrop-filter: blur(12px);
}

.portfolio-language-switch.is-open .portfolio-language-options,
.portfolio-language-switch:focus-within .portfolio-language-options {
  display: flex;
}

.portfolio-language-switch button:hover,
.portfolio-language-switch button:focus-visible {
  border-color: rgba(198, 156, 109, 0.72);
  background: rgba(198, 156, 109, 0.12);
  outline: none;
}

.portfolio-language-switch button.active {
  background: rgba(198, 156, 109, 0.18);
  color: #4a3428;
}

@media (max-width: 720px) {
  .portfolio-language-switch {
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    right: 8px;
  }

  .forum-header > .portfolio-language-switch--mobile {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: center;
    width: auto;
    min-height: 2.65rem;
    margin-right: calc(2.65rem + 8px);
    justify-content: center;
  }

  .forum-header > .portfolio-language-switch--mobile .portfolio-language-trigger {
    width: 2.65rem;
    height: 2.65rem;
    padding: 0;
    border-radius: 12px !important;
  }

  .forum-header > .portfolio-language-switch--mobile .portfolio-language-options {
    top: calc(100% + 8px);
    right: 0;
  }
}

@media (max-width: 420px) {
  .forum-header > .portfolio-language-switch--mobile {
    margin-right: calc(2.65rem + 6px);
  }
}
