.WebPage {
  position: relative;

  overflow: hidden;

  max-width: 29rem;
  margin-top: 0.25rem;
  margin-bottom: 0.125rem;
  padding-block: 0.1875rem;
  border-radius: 0.25rem;

  font-size: calc(var(--message-text-size, 1rem) - 0.0625rem);
  line-height: 1.125rem;
  color: var(--color-text);

  background-color: var(--accent-background-color);

  &.with-video {
    padding-block: 0.375rem;
  }

  &--background-icons {
    margin: -0.375rem;
  }

  &--emoji-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 0.25rem;
  }

  &--sticker {
    position: relative;

    overflow: hidden;

    width: 100%;
    height: 100%;
    border-radius: 0.25rem;
  }

  &--stickers {
    border-radius: 0 !important;
    color: var(--accent-color);
  }

  .WebPage--content {
    position: relative;

    &.is-gift,
    &.is-story {
      display: flex;
      flex-direction: column-reverse;
    }
  }

  &--quick-button {
    --riple-color: var(var(--accent-background-active-color));

    width: calc(100% - 0.25rem);
    margin-top: 0.375rem;
    margin-bottom: -0.375rem;
    margin-inline-start: 0.25rem;
    border-top: 1px solid var(--accent-background-active-color, var(--active-color));

    color: var(--accent-color) !important;

    transition: opacity 0.2s ease-in;

    &:hover, &:active {
      opacity: 0.85;
      background-color: transparent !important;
    }
  }

  .with-gift &--quick-button {
    margin-top: 0.0625rem;
    margin-bottom: -0.125rem;
    border-top: inherit;
  }

  &-text {
    position: relative;

    display: flex;
    flex-direction: column;
    flex-grow: 1;
    align-items: flex-start;

    &_interactive {
      cursor: var(--custom-cursor, pointer);
      transition: opacity 0.15s;

      &:hover {
        opacity: 0.75;
      }
    }
  }

  .media-inner {
    margin: 0 !important;
    margin-block-start: 0.25rem !important;
    margin-block-end: 0.1875rem !important;

    &,
    & img,
    & canvas,
    &.small-image img {
      --border-top-left-radius: var(--border-radius-messages-small);
      --border-top-right-radius: var(--border-radius-messages-small);
      --border-bottom-left-radius: var(--border-radius-messages-small);
      --border-bottom-right-radius: var(--border-radius-messages-small);
    }

    &.square-image {
      width: 100%;
      height: 100%;
      min-height: 0;
      margin-bottom: 0 !important;

      canvas,
      img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain;
      }
    }
  }

  .message-content:not(.has-reactions):not(.is-inverted-media) & {
    margin-bottom: calc(var(--message-meta-height)) !important;
  }

  &.with-square-photo .WebPage--content {
    display: flex;

    .WebPage-text {
      order: 1;
      padding-inline-end: 1rem;
    }

    .media-inner {
      flex-shrink: 0;
      order: 2;

      &.square-image {
        width: 5rem;
        height: 5rem;
        min-height: 0;
        margin-bottom: 0 !important;

        img {
          width: 100%;
          height: 100%;
          object-fit: cover;
        }
      }
    }

    &:dir(rtl) {
      .WebPage-text {
        padding-inline-end: 1rem;
      }
    }
  }

  .site-name,
  .site-description,
  .site-title {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .site-name {
    margin-bottom: 0.125rem;
    font-weight: var(--font-weight-semibold);
    color: var(--accent-color);
  }

  .site-title {
    margin-bottom: 0.125rem;
    font-weight: var(--font-weight-semibold);
  }

  .site-description {
    margin-bottom: 0.125rem;
    line-height: 1.25;

    body.is-ios & {
      line-height: 1.125rem;
    }
  }

  @media (min-width: 1921px) {
    max-width: none;

    .thumbnail,
    .full-media {
      width: 100% !important;
      height: auto !important;
    }
  }
}
