Encode and decode Base64. Supports standard, URL-safe variants, and automatic detection of encoded data.