/* Keep the mobile section order introduced in v44. */
@media (max-width: 767px) {
  #asProfile .pp-overview.pp-mobile-order { display: flex; flex-direction: column; gap: 0; }
  #asProfile .pp-overview.pp-mobile-order > .pp-main-column { width: 100%; gap: 16px; }
  #asProfile .pp-mobile-order .pp-gifts-card .gifts-items { margin: 8px 0 !important; }
  #asProfile .pp-mobile-order .pp-visitors-card #users_visit {
    display: grid !important; grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px; align-items: start; padding: 4px 0; min-width: 0;
  }
  #asProfile .pp-mobile-order .pp-visitors-card #users_visit .user_visit {
    display: block; box-sizing: border-box; width: 100%; height: auto;
    min-width: 0; aspect-ratio: 1; margin: 0; padding: 0;
  }
  #asProfile .pp-mobile-order .pp-visitors-card #users_visit .user_visit > img {
    display: block; width: 100% !important; height: 100% !important;
    margin: 0 !important; object-fit: cover;
  }
  #asProfile .pp-mobile-order .pp-visitors-card #users_visit > .empty-element { grid-column: 1 / -1; }
}

/* Size the card as well as the image: the old 64px height cropped mobile gifts. */
html body #asProfile .pp-overview .pp-gifts-card .gifts-items > .gift {
  position: relative; display: block; box-sizing: border-box;
  width: 100%; height: auto; min-width: 0; min-height: 0;
  aspect-ratio: 1; padding: 0; overflow: hidden;
}
html body #asProfile .pp-overview .pp-gifts-card .gifts-items > .gift img {
  position: absolute; inset: 0; display: block; box-sizing: border-box;
  width: 100% !important; height: 100% !important;
  max-width: 100%; max-height: 100%; margin: 0 !important;
  padding: 6px; object-fit: contain; object-position: center;
}

@media (max-width: 767px) {
  /* Preserve the comment DOM and handlers; let its content span the whole card. */
  html body #asProfile #comments .comment.pwr-comment-card {
    display: grid; grid-template-columns: 50px minmax(0, 1fr) !important;
    grid-template-rows: auto auto auto; gap: 10px 12px;
    padding: 12px; margin-bottom: 12px;
  }
  html body #asProfile #comments .pwr-comment-card::before,
  html body #asProfile #comments .pwr-comment-card > .news-comment-footer::before {
    content: none; display: none;
  }
  html body #asProfile #comments .pwr-comment-card > .pwr-avatar {
    grid-column: 1; grid-row: 1; margin: 0; align-self: start;
  }
  html body #asProfile #comments .pwr-comment-card > .news-comment-content { display: contents; }
  html body #asProfile #comments .pwr-comment-card .info {
    grid-column: 2; grid-row: 1; position: relative; display: block;
    min-width: 0; height: auto; min-height: 50px; padding: 0 22px 0 0;
  }
  html body #asProfile #comments .pwr-comment-card .info .author {
    display: flex !important; align-items: center; flex-wrap: wrap; gap: 4px;
    float: none; width: auto; min-width: 0; max-width: none;
    height: auto; min-height: 20px; margin: 0; line-height: 1.4;
  }
  html body #asProfile #comments .pwr-comment-card .author > a {
    max-width: 100%; height: auto; line-height: inherit;
    white-space: normal; overflow-wrap: anywhere;
  }
  html body #asProfile #comments .pwr-comment-card .news-user-badges {
    display: inline-flex; flex-wrap: wrap; gap: 4px; margin: 0; line-height: 1;
  }
  html body #asProfile #comments .pwr-comment-card .info .date {
    display: block; position: static; float: none; clear: none;
    width: auto; height: auto; margin: 3px 0 0; padding: 0;
    font-size: 12px; line-height: 1.4; white-space: normal;
  }
  html body #asProfile #comments .pwr-comment-card .info .dell_message {
    position: absolute; top: 0; right: 0; margin: 0;
  }
  html body #asProfile #comments .pwr-comment-card .news-comment-content > .with_code {
    grid-column: 1 / -1; grid-row: 2; min-width: 0;
    padding: 0; margin: 0; overflow-wrap: anywhere;
  }
  html body #asProfile #comments .pwr-comment-card .with_code > :first-child { margin-top: 0; }
  html body #asProfile #comments .pwr-comment-card .with_code > :last-child { margin-bottom: 0; }
  html body #asProfile #comments .pwr-comment-card .with_code :is(img, video, iframe) { max-width: 100%; }
  html body #asProfile #comments .pwr-comment-card .with_code img { height: auto; }
  html body #asProfile #comments .pwr-comment-card .with_code :is(pre, table) { max-width: 100%; overflow-x: auto; }
  html body #asProfile #comments .pwr-comment-card > .news-comment-footer {
    grid-column: 1 / -1; grid-row: 3; display: flex; align-items: center;
    flex-wrap: wrap; gap: 8px; padding: 8px 0 0; margin: 0;
    border-top: 1px solid var(--pf-border);
  }
  html body #asProfile #comments .pwr-comment-card .news-comment-tools {
    display: flex; flex: 0 0 auto; justify-content: flex-start; gap: 6px;
  }
  html body #asProfile #comments .pwr-comment-card .news-comment-tools .news-add-reaction {
    width: 36px; height: 36px; margin: 0;
  }
  html body #asProfile #comments .pwr-comment-card .news-comment-footer > .fr-post {
    flex: 1 1 120px; min-width: 0; padding: 0;
  }
}

/* Uploaded covers stay behind the complete header, including on phones.
   Keep artwork/contrast outside the site's automatic palette rewriting. */
@supports (--private-theme-static: 1) {
  @media (max-width: 767px) {
    html body #asProfile .pp-hero-overlay.pp-custom-cover .pp-cover {
      position: absolute; inset: 0; width: 100%; height: 100%;
      min-height: 0; aspect-ratio: auto; border-radius: inherit;
    }
    html body #asProfile .pp-hero-overlay.pp-custom-cover .pp-cover > .pp-cover-media {
      width: 100%; height: 100%; object-fit: cover !important;
      object-position: center !important;
    }
    html body #asProfile .pp-hero-overlay.pp-custom-cover .pp-cover::after {
      content: "" !important; display: block !important; opacity: 1 !important;
      background: linear-gradient(180deg, rgba(8,13,20,.34), rgba(8,13,20,.62)) !important;
    }
    html body #asProfile .pp-hero-overlay.pp-custom-cover .pp-hero-main {
      --pp-hero-text: #f7f9fc; --pp-hero-muted: #e2e7ed;
      position: relative; z-index: 1; background: transparent !important;
    }
  }
}
