/* ── Profile identity badges ── */
.profile-identities {
  position: relative;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
  margin: 0 auto 18px;
  padding: 0 4px;
}

.profile-identities[hidden] {
  display: none;
}

.profile-identities-add-btn {
  position: relative;
  z-index: 3;
  margin: 0 auto 18px;
}

.profile-identities-add-btn[hidden] {
  display: none !important;
}

.bio:has(+ .profile-identities:not([hidden])) {
  margin-bottom: 14px;
}

.bio:has(+ .profile-identities[hidden] + .profile-identities-add-btn:not([hidden])) {
  margin-bottom: 14px;
}

.identity-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 5px 10px 5px 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

.identity-pill__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  object-fit: contain;
  display: block;
}

.identity-pill__label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 8.5rem;
}

/* ── Edit Profile identity selector ── */
.profile-identity-accordion .profile-bg-accordion__toggle {
  border-color: rgba(var(--accent-r), 0.35);
  background: rgba(var(--accent-r), 0.08);
}

.identity-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.identity-editor__meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.identity-editor__count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
}

.identity-editor__hint {
  margin: 0;
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.identity-editor__selected {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.identity-editor__selected-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.identity-editor__move-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.72rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), opacity var(--transition);
}

.identity-editor__move-btn:hover:not(:disabled),
.identity-editor__move-btn:focus-visible {
  background: rgba(var(--accent-r), 0.12);
  border-color: var(--accent-border);
  outline: none;
}

.identity-editor__move-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.identity-editor__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.identity-editor__option {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.22);
  cursor: pointer;
  text-align: left;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition),
    background var(--transition);
}

.identity-editor__option-inner {
  position: relative;
  display: block;
}

.identity-editor__option:hover:not(.is-selected-in-list) {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.3);
}

.identity-editor__option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.identity-editor__option.is-selected-in-list {
  cursor: pointer;
  border-color: rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.38);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.identity-editor__option.is-selected-in-list:hover,
.identity-editor__option.is-selected-in-list:focus-visible {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(40, 10, 10, 0.42);
}

.identity-editor__option.is-selected-in-list .identity-pill {
  filter: saturate(0.28) brightness(0.68);
  opacity: 0.78;
  padding-right: 30px;
}

.identity-editor__option.is-selected-in-list::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(8, 8, 12, 0.28);
  pointer-events: none;
}

.identity-editor__option .identity-pill {
  width: 100%;
  pointer-events: none;
}

.identity-editor__remove {
  position: absolute;
  top: 50%;
  right: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ff5a5a 0%, #ef4444 100%);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.45);
  pointer-events: none;
  transform: translateY(-50%);
  opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
  .identity-editor__remove {
    opacity: 0;
    transition: opacity 0.18s ease, transform 0.18s ease;
  }

  .identity-editor__option.is-selected-in-list:hover .identity-editor__remove,
  .identity-editor__option.is-selected-in-list:focus-visible .identity-editor__remove {
    opacity: 1;
    transform: translateY(-50%) scale(1.04);
  }
}

.identity-pill--editor-preview {
  padding: 4px 8px 4px 6px;
}

.identity-pill--editor-preview .identity-pill__icon {
  width: 18px;
  height: 18px;
}

.identity-pill--editor-preview .identity-pill__label {
  font-size: 0.68rem;
}

@media (max-width: 520px) {
  .profile-identities {
    gap: 6px;
    margin-bottom: 16px;
  }

  .identity-pill {
    gap: 5px;
    padding: 4px 8px 4px 6px;
  }

  .identity-pill__icon {
    width: 17px;
    height: 17px;
  }

  .identity-pill__label {
    font-size: 0.66rem;
    max-width: 6.8rem;
  }

  .identity-editor__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 360px) {
  .profile-identities {
    gap: 5px;
  }

  .identity-pill__label {
    max-width: 5.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .identity-editor__option,
  .identity-editor__move-btn,
  .identity-editor__remove {
    transition: none;
  }
}
