.entity-profile {
  --profile-radius-xl: 30px;
  --profile-radius-lg: 22px;
  --profile-radius-md: 16px;
  width: min(1240px, calc(100% - 48px));
  margin: 104px auto 80px;
  color: var(--text);
}

.entity-profile * {
  box-sizing: border-box;
}

.entity-profile-hero,
.profile-page .profile-header.entity-profile-hero,
.organization-public.entity-profile .organization-public-hero.entity-profile-hero {
  position: relative;
  width: 100%;
  min-height: 390px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--profile-radius-xl);
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow-overlay);
  isolation: isolate;
}

.entity-profile-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 30%, var(--loBackground3) 72%, var(--card) 100%);
}

.entity-profile .profile-banner,
.entity-profile .organization-public-banner {
  position: absolute;
  inset: 0;
  z-index: -3;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  object-fit: cover;
  transform: none !important;
  filter: saturate(0.9) contrast(0.98);
}

.entity-profile .profile-banner-gradient,
.entity-profile .profile-background,
.entity-profile .organization-public-banner-shade {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    105deg,
    var(--loBackground5) 0%,
    var(--loBackground2) 52%,
    transparent 100%
  );
}

.entity-profile-identity,
.profile-page .profile-info.entity-profile-identity,
.organization-public.entity-profile .organization-public-identity.entity-profile-identity {
  position: absolute;
  left: 34px;
  right: 34px;
  bottom: 30px;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  gap: 24px;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface-overlay-strong);
  box-shadow: var(--shadow-floating);
  backdrop-filter: blur(18px);
}

.entity-profile .user-profile-pic-container,
.entity-profile .organization-public-identity > img {
  position: relative;
  flex: 0 0 132px;
  width: 132px;
  height: 132px;
  margin: 0;
  border: 1px solid var(--border-hover);
  border-radius: 28px;
  overflow: hidden;
  background: var(--background2);
  box-shadow: var(--shadow-card);
}

.entity-profile .user-profile-pic,
.entity-profile .organization-public-identity > img {
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: cover;
}

.entity-profile .user-profile-pic-frame {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: auto;
}

.entity-profile-heading,
.entity-profile .organization-public-identity > div {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  margin: 0;
}

.entity-profile .user-profile-username,
.entity-profile .organization-public-identity h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.045em;
  text-shadow: var(--text-shadow2);
}

.entity-profile .organization-public-identity span,
.entity-profile .profile-followers-count {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--background2);
  color: var(--text2);
  font-size: 12px;
  font-weight: 700;
}

.entity-profile .organization-public-identity p {
  max-width: 720px;
  margin: 0;
  color: var(--text2);
  font-size: 14px;
  line-height: 1.55;
}

.entity-profile .header-button-container,
.entity-profile .friend-message-container,
.entity-profile .organization-public-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 6px 0 0;
}

.entity-profile .organization-public-actions {
  position: absolute;
  top: 26px;
  right: 26px;
  z-index: 4;
}

.entity-profile .profile-social-button,
.entity-profile .message-button,
.entity-profile .edit-profile-button,
.entity-profile .profile-shop-btn,
.entity-profile .profile-copy-btn,
.entity-profile .friend-add-button,
.entity-profile .organization-public-actions a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--button2);
  color: var(--button2-text);
  text-decoration: none;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.entity-profile .profile-copy-btn,
.entity-profile .profile-shop-btn,
.entity-profile .friend-add-button,
.entity-profile .organization-public-actions a {
  width: 42px;
  padding: 0;
}

.entity-profile .profile-social-button:hover,
.entity-profile .message-button:hover,
.entity-profile .edit-profile-button:hover,
.entity-profile .profile-shop-btn:hover,
.entity-profile .profile-copy-btn:hover,
.entity-profile .friend-add-button:hover,
.entity-profile .organization-public-actions a:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  background: var(--button2-hover);
}

.entity-profile .profile-social-button.is-danger {
  color: var(--accent-danger);
}

.entity-profile-layout,
.profile-page .profile-container.entity-profile-layout,
.organization-public.entity-profile .organization-public-layout.entity-profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.75fr);
  gap: 20px;
  width: 100%;
  max-width: none;
  margin: 22px 0 0;
  padding: 0;
  align-items: start;
}

.entity-profile-user .entity-profile-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.entity-profile-main,
.entity-profile-sidebar,
.organization-public.entity-profile .organization-public-main,
.organization-public.entity-profile .organization-public-sidebar {
  display: grid;
  gap: 20px;
  min-width: 0;
  width: auto;
  margin: 0;
}

.entity-profile-panel,
.profile-page .entity-profile-panel,
.organization-public.entity-profile .organization-public-panel.entity-profile-panel {
  min-width: 0;
  margin: 0;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--profile-radius-lg);
  background: linear-gradient(145deg, var(--card), var(--background2));
  box-shadow: var(--shadow-card);
  color: var(--text);
  overflow: hidden;
}

.entity-profile-panel h2,
.organization-public.entity-profile .entity-profile-panel h2 {
  margin: 0 0 18px;
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.015em;
  text-transform: none;
}

.entity-profile-panel > p,
.entity-profile-panel small {
  color: var(--text2);
}

.entity-profile-user .profile-advancements,
.entity-profile-user .profile-inventory,
.entity-profile-user .profile-cards,
.entity-profile-user .profile-friends,
.entity-profile-user .profile-level,
.entity-profile-user .profile-comments {
  position: relative;
  inset: auto;
  width: auto;
  height: auto;
  min-height: 210px;
  transform: none;
}

.entity-profile-user .profile-comments {
  grid-column: 1 / -1;
  min-height: 0;
}

.entity-profile-user .profile-level {
  min-height: 180px;
}

.entity-profile-user .profile-purple-grid,
.entity-profile-user .profile-black-grid,
.entity-profile-user .profile-cards-grid,
.entity-profile-user .profile-friend-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  margin: 0 0 18px;
}

.entity-profile-user .profile-purple-grid > div,
.entity-profile-user .profile-black-grid > div,
.entity-profile-user .profile-card,
.entity-profile-user .profile-friend-list > div {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--background3);
}

.entity-profile-user .profile-advancements button,
.entity-profile-user .profile-inventory button,
.entity-profile-user .profile-cards button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--button2);
  color: var(--button2-text);
  font: inherit;
  font-size: 11px;
  font-weight: 800;
}

.entity-profile-user .profile-progress-wrapper {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.entity-profile-user .profile-bar {
  position: relative;
  height: 44px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--background3);
}

.entity-profile-user .profile-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--text3), var(--text));
  transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.entity-profile-user .profile-exp-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--text-inverse);
  font-size: 11px;
  font-weight: 800;
  mix-blend-mode: difference;
}

.entity-profile-user .profile-level-number {
  color: var(--text2);
  font-size: 18px;
  font-weight: 800;
}

.organization-public.entity-profile .organization-public-listings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.organization-public.entity-profile .organization-public-sidebar ul {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.organization-public.entity-profile .organization-public-sidebar li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--background2);
}

.organization-public.entity-profile .organization-public-sidebar li > i {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--background3);
  color: var(--text2);
}

.organization-public.entity-profile .organization-public-sidebar li span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.organization-public.entity-profile .organization-public-sidebar li small {
  color: var(--text3);
}
.organization-public.entity-profile .organization-public-sidebar li strong {
  color: var(--text);
}

.organization-public.entity-profile .organization-public-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.organization-public.entity-profile .organization-public-categories span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--background2);
  color: var(--text2);
  font-size: 11px;
  font-weight: 700;
}

.entity-profile .image-modal-overlay {
  z-index: 11000;
  background: var(--overlay-backdrop);
  backdrop-filter: blur(12px);
}

.profile-blocked-state {
  min-height: calc(100vh - 80px);
  display: grid;
  place-items: center;
  padding: 110px 24px 50px 424px;
}

.profile-blocked-state > section {
  width: min(520px, 100%);
  padding: 36px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--card);
  color: var(--text);
  text-align: center;
  box-shadow: var(--shadow-overlay);
}

@media (max-width: 980px) {
  .entity-profile {
    width: min(100% - 28px, 1240px);
    margin-top: 94px;
  }
  .entity-profile-layout,
  .profile-page .profile-container.entity-profile-layout,
  .organization-public.entity-profile .organization-public-layout.entity-profile-layout,
  .entity-profile-user .entity-profile-layout {
    grid-template-columns: 1fr;
  }
  .organization-public.entity-profile .organization-public-listings {
    grid-template-columns: 1fr;
  }
  .profile-blocked-state {
    padding-left: 24px;
  }
}

@media (max-width: 700px) {
  .entity-profile {
    width: calc(100% - 20px);
    margin: 88px auto 50px;
  }
  .entity-profile-hero,
  .profile-page .profile-header.entity-profile-hero,
  .organization-public.entity-profile .organization-public-hero.entity-profile-hero {
    min-height: 500px;
    border-radius: 22px;
  }
  .entity-profile-identity,
  .profile-page .profile-info.entity-profile-identity,
  .organization-public.entity-profile .organization-public-identity.entity-profile-identity {
    left: 12px;
    right: 12px;
    bottom: 12px;
    flex-direction: column;
    align-items: flex-start;
    padding: 18px;
    border-radius: 19px;
  }
  .entity-profile .user-profile-pic-container,
  .entity-profile .organization-public-identity > img {
    flex-basis: 104px;
    width: 104px;
    height: 104px;
    border-radius: 22px;
  }
  .entity-profile .organization-public-actions {
    top: 12px;
    right: 12px;
  }
  .entity-profile-panel,
  .profile-page .entity-profile-panel,
  .organization-public.entity-profile .organization-public-panel.entity-profile-panel {
    padding: 18px;
    border-radius: 18px;
  }
  .entity-profile-user .profile-purple-grid,
  .entity-profile-user .profile-black-grid,
  .entity-profile-user .profile-cards-grid,
  .entity-profile-user .profile-friend-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .entity-profile *,
  .entity-profile *::before,
  .entity-profile *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
