/*
 * https://github.com/morethanwords/tweb
 * Copyright (C) 2019-2021 Eduard Kuzmenko
 * https://github.com/morethanwords/tweb/blob/master/LICENSE
 */

@use "sass:math";

@keyframes bubbleSelected {
  0% {
    opacity: 0;
  }

  25% {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

.bubbles-date-group {
  position: relative;

  /* .sticky_sentinel {
    visibility: visible;
    background: #000;
  } */

  .sticky_sentinel--top {
    /* Adjust the height and top values based on your on your sticky top position.
    e.g. make the height bigger and adjust the top so observeHeaders()'s
    IntersectionObserver fires as soon as the bottom of the sentinel crosses the
    top of the intersection container. */
    height: $bubble-overflow-big;
    top: 0;
  }

  // .sticky_sentinel--bottom {
  //   /* Height should match the top of the header when it's at the bottom of the
  //   intersection container. */
  //   height: 1px;
  //   bottom: 0;
  // }
}

.bubbles-group {
  position: relative;

  &-avatar {
    position: sticky !important;
    top: 0;
    bottom: $bubble-overflow-big;
    cursor: pointer;
    pointer-events: all;
    overflow: hidden;

    .bubbles.is-selecting & {
      transform: translate3d(0, 0, 0) scale3d(1, 1, 1);
      transform-origin: bottom;
    }

    &.is-gesturing-reply {
      transform: translateX(0);

      &.animating.backwards {
        transition: transform var(--transition-standard-out);
      }
    }

    &-container {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      display: flex;
      flex-direction: column-reverse;

      // make avatar clickable
      z-index: 2;
      pointer-events: none;
    }
  }
}

.bubble {
  --line-height: var(--messages-line-height);
  --primary-color: var(--message-primary-color);
  --primary-color-rgb: var(--message-primary-color-rgb);
  --secondary-text-color: var(--message-status-color);
  --peer-color-rgb: var(--message-primary-color-rgb);
  --peer-border-background: rgb(var(--peer-color-rgb));
  --max-width: 100%;
  position: relative;
  z-index: 1;
  margin: 0 auto $bubble-margin;
  user-select: none;
  display: flex;
  flex-wrap: wrap;
  box-sizing: border-box;
  //flex-direction: column; // fix 'Unread messages', still need to refactor it

  &.is-sponsored {
    --max-width: calc(80% - var(--message-beside-button-margin) * -1) !important;
    width: 100%;
    order: 999999;
    margin-bottom: 0;

    .bubble-content-wrapper {
      width: 100%;
    }

    .bubble-content {
      min-width: unquote('min(100%, 15rem)') !important;
    }
  }

  // &.is-deleting:after {
  //   display: none;
  // }

  &:not(.service) {
    @include respond-to(not-handhelds) {
      --max-width: 85%;
    }
  }

  @include respond-to(handhelds) {
    --max-width: calc(100% - var(--message-handhelds-margin)) !important;
  }

  &.is-gesturing-reply {
    transform: translateX(0);
    
    &.animating.backwards {
      transition: transform var(--transition-standard-out);
    }

    .bubble-gesture-reply-icon {
      width: var(--message-beside-button-size);
      height: var(--message-beside-button-size);
      position: absolute;
      top: 50%;
      right: var(--message-beside-button-margin);
      transform: translateY(-50%);
      color: #fff;
      border-radius: 50%;
      background-color: var(--message-highlighting-color);
      opacity: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      transform: translateY(-50%) scale(0.6);
      visibility: hidden;
      font-size: 1.125rem !important;

      @include animation-level(2) {
        transition: transform .1s ease-in-out;
      }

      &.is-visible {
        visibility: visible;
        // opacity: 1;
        transform: translateY(-50%) scale(1);
      }
    }
  }

  &.is-highlighted, 
  &.is-selected, 
  /* .bubbles.is-selecting */ & {
    &:after {
      position: absolute;
      left: 50%;
      transform: translateX(-50%);
      /* top: 0;
      bottom: 0; */
      top: -#{$bubble-overflow};
      bottom: -#{$bubble-overflow};
      content: " ";
      z-index: -1;
    }
  }

  /* &.is-highlighted, &.is-selected {
    &:not(.is-group-last):after {
      height: calc(100% + #{$bubble-overflow}) !important;
    }

    & + &:not(.is-group-last) {
      &:after {
        top: .125rem !important;
        height: calc(100% - #{$bubble-overflow}) !important;
      }
    }
  } */

  // ! if turn this on, there will be an empty space
  /* &.is-highlighted, &.is-selected {
    &.is-group-last:after {
      bottom: #{$bubble-overflow} !important;
    }
  } */

  &.is-highlighted:after {
    //background-color: rgba(0, 132, 255, .3);
    background-color: var(--message-highlighting-color);

    body:not(.animation-level-0) & {
      animation: bubbleSelected 2s linear;
    }
  }

  &.is-first-unread {
    @include respond-to(handhelds) {
      max-width: unset;
    }

    &:before {
      content: var(--unread-messages-text);
      height: 30px;
      margin-bottom: $bubble-overflow-big;
      margin-left: -50%;
      margin-right: -50%;
      width: 200vw;
      text-align: center;
      color: var(--primary-color);
      line-height: 2.1;
      font-weight: var(--font-weight-bold);
      font-size: 15px;
      background-color: var(--surface-color);
      z-index: 2;
      position: relative;
    }

    &.is-highlighted,
    &.is-selected {
      &:after {
        top: calc(#{$bubble-overflow} + 30px);
      }
    }
  }

  &.is-selected {
    &:after {
      background-color: var(--message-highlighting-color);
    }

    body:not(.animation-level-0) & {
      &:after {
        animation: fade-in-opacity .2s linear forwards;
      }

      &.backwards:after {
        animation: fade-in-backwards-opacity .2s linear forwards;
      }
    }
  }

  //&.is-highlighted:after, &.is-first-unread:before, &.is-selected:after {
  &:after, 
  &:before {
    width: 100vw;
    display: block;
  }

  &.is-multiple-documents {
    &:before, 
    &:after {
      display: none;
    }

    .user-avatar {
      z-index: 2;
    }
  }

  .replies-footer + .poll-message .poll-footer-button {
    border-radius: 0 !important;
  }

  &-select-checkbox {
    z-index: 3;
    position: absolute;
    inset-inline-start: 0;
    display: flex;
    margin: 0;

    .checkbox-box-border {
      border-color: var(--message-checkbox-border-color);
    }

    .checkbox-box-background {
      background-color: var(--message-checkbox-color);
    }

    .checkbox-box-check {
      use {
        stroke-width: 3.5;
      }
    }
  }

  & > &-select-checkbox {
    //bottom: .75rem; // * by avatar
    bottom: .3125rem; // * by middle of one-line message
    /* left: 0;
    top: 50%;
    transform: translateY(-50%); */
    .checkbox-box {
      box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, .4);
    }
  }

  .bubbles.is-selecting &:not(.is-album) {
    .audio, 
    .document, 
    .attachment, 
    poll-element {
      pointer-events: none !important;
    }
  }

  // ! hide context menu for media on android
  .bubbles.is-selecting & {
    img, 
    video,
    a {
      pointer-events: none;
    }
  }
  
  &-content {
    //min-width: 60px;
    min-width: 56px;
    max-width: 100%;
    border-start-start-radius: var(--border-start-start-radius);
    border-start-end-radius: var(--border-start-end-radius);
    border-end-start-radius: var(--border-end-start-radius);
    border-end-end-radius: var(--border-end-end-radius);
    box-shadow: 0 1px 2px 0 rgba(16, 35, 47, .15);
    position: relative;
    // display: flex;
    // flex-direction: column-reverse;
    // align-items: flex-start;
    z-index: 2;
    user-select: none;
    background-color: var(--message-background-color);

    body.animation-level-0 & {
      transition: none;
    }

    /* html.no-touch .bubbles:not(.is-selecting) &,
    html.is-touch .bubbles.is-selecting:not(.no-select) & {
      user-select: text;
    } */
    html.no-touch body:not(.no-select) .bubbles:not(.is-selecting) &,
    html.is-touch body:not(.no-select) .bubbles.is-selecting & { // * need no-select on body because chat-input transforms in channels
      user-select: text;
    }

    &.hover-reaction-visible {
      .bubble-beside-button {
        transform: translateX(calc(1.125rem * var(--reflect)));

        .bubble.is-out & {
          transform: translateX(calc(-1.125rem * var(--reflect)));

          &.goto-original {
            transform: translateX(calc(-1.125rem * var(--reflect))) rotate(180deg);
          }
        }
      }
    }

    &.is-clickable {
      cursor: pointer;
    }

    &-background {
      background-color: inherit;
      border-radius: inherit;
      position: absolute;
      inset: 0;
      z-index: -1;
    }
  }

  &-hover-reaction {
    --size: 1.875rem;
    --offset: calc(var(--size) * -.75);
    position: absolute;
    inset-inline-end: var(--offset);
    // bottom: -.0625rem;
    bottom: 0;
    width: var(--size);
    height: 1.625rem;
    border-radius: var(--size);
    z-index: 2;
    background-color: var(--surface-color);
    cursor: pointer;
    opacity: 0;
    transform: scale(.8);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--menu-box-shadow);

    @include animation-level(2) {
      transition: opacity var(--btn-corner-transition), transform var(--btn-corner-transition);
    }

    &.is-visible {
      &:not(.backwards) {
        transform: scale(1);
        opacity: 1;
      }
    }

    &-sticker {
      width: 1.125rem;
      height: 1.125rem;
      position: relative;
    }
  }

  /* &.with-beside-button &-content {
    @include respond-to(handhelds) {
      max-width: calc(100% - var(--message-handhelds-margin)) !important;
    }
  } */

  /* &.with-beside-button &-content {
    margin-right: calc(var(--message-beside-button-margin) * -1);
  } */
  
  &.service {
    max-width: var(--messages-container-width);

    .bubble-content {
      margin: 0 auto;
      max-width: 100%;
      box-shadow: none;
    }
  }

  &.is-date {
    position: sticky;
    top: $bubble-overflow-big;
    padding-bottom: #{$bubble-overflow-big + $bubble-margin};
    z-index: 2;
    transition: opacity .3s ease;
    opacity: .99999; // for safari
    pointer-events: none;
    font-weight: var(--font-weight-bold);

    &:before, 
    &:after {
      display: none;
    }

    body.animation-level-0 & {
      transition: none;
    }

    &.is-sticky {
      opacity: .00001; // for safari

      .bubbles-inner:not(.is-scrolling) & {
        .bubble-content {
          cursor: default;
        }
      }
    }

    .can-click-date & .bubble-content {
      cursor: pointer;
      pointer-events: all;
    }

    .bubbles:not(.has-sticky-dates) & {
      visibility: hidden;
    }

    .bubbles.has-sticky-dates &.is-fake {
      display: none;
    }

    &.is-fake {
      position: absolute;
      top: 0;
      left: 50%;
      transform: translateX(-50%);
      opacity: 1 !important;
      transition: none !important;
      visibility: visible !important;
    }
  }

  &-beside-button {
    position: absolute;
    inset-inline-end: var(--message-beside-button-margin);
    bottom: 0;
    width: var(--message-beside-button-size);
    height: var(--message-beside-button-size);
    font-size: 1.5rem;
    align-items: center;
    display: flex;
    justify-content: center;
    color: var(--badge-text-color);
    border-radius: 50%;
    //background: rgba(0, 0, 0, .16);
    background: var(--message-highlighting-color);
    cursor: pointer;
    transform: translateX(0);

    &-top {
      inset-block: .375rem auto;
    }

    html.no-touch &.with-hover {
      opacity: 0;
    }

    html.no-touch body.animation-level-2 & {
      transition: opacity .2s ease-in-out, transform .2s ease-in-out;
    }

    &--transcribe {
      font-size: 1.375rem;
    }
    &--lifted {
      bottom: calc(var(--message-beside-button-size) + 0.25rem);
    }
  }

  &-view-button {
    --ripple-color: rgba(var(--peer-color-rgb), .1);
    border-radius: 6px;
    // color: var(--message-primary-color);
    color: rgb(var(--peer-color-rgb));
    height: 2.5rem;
    margin: 0 0.5625rem .25rem;
    width: calc(100% - 1.125rem);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    padding: 0 .375rem;
    background-color: rgba(var(--peer-color-rgb), .1);

    &-text {
      @include text-overflow(true);
    }

    @include hover() {
      background-color: rgba(var(--peer-color-rgb), .2);
    }

    .message & {
      margin: .375rem 0 -.375rem;
      width: 100%;
      max-width: 100%;

      @include text-overflow(true);
    }
  }

  @include hover() {
    .bubble-beside-button {
      opacity: 1;
    }
  }

  .forward {
    font-size: 1.25rem;
  }

  &.is-group-last {
    margin-bottom: #{$bubble-margin-big};

    &:after {
      bottom: -#{$bubble-overflow-big};
    }

    .bubbles-inner.is-chat &.is-in {
      > .bubble-select-checkbox {
        bottom: .1875rem;
      }
    }
  }

  &.is-group-first {
    &:after {
      top: -#{$bubble-overflow-big};
    }
  }

  &:not(.forwarded):not(.must-have-name) {
    &:not(.is-group-first) {
      .name {
      // .bubble-content > .name, 
      // .document-wrapper > .name {
        display: none;
      }
    }
  }

  &:not(.forwarded) {
    &:not(.is-group-first) {
      .name-first-line {
        display: none;
      }
    }
  }

  &.photo, 
  &.video {
    .bubble-content {
      width: min-content;
    }
  }

  &.emoji-big .emoji-image {
    height: 1.125rem;
    width: 1.125rem;
    vertical-align: bottom;
  }

  .thumbnail {
    position: absolute;
  }

  .canvas-thumbnail {
    border-radius: inherit;
  }

  .canvas-dots {
    z-index: 1;
  }

  &.emoji-big {
    --emoji-size: 1rem;
    font-size: 0;

    .bubble-content {
      line-height: 1;
    }

    .attachment {
      --custom-emoji-size: var(--emoji-size);
      border-radius: 0 !important;

      .emoji-image {
        width: var(--emoji-size);
        height: var(--emoji-size);
        max-width: 64px;
        max-height: 64px;
      }

      .custom-emoji,
      .emoji {
        display: inline-block;
      }
    }

    &:not(.sticker) {
      .attachment {
        padding-top: .25rem;
        padding-bottom: 1.25rem;
        //max-width: fit-content!important;
        max-height: fit-content!important;

        display: block;
        white-space: pre-wrap;
        word-break: break-word;
        font-size: var(--emoji-size);
        
        .emoji-native {
          height: auto;
          width: auto;
        }
      }

      .message {
        margin-top: -1.125rem;
      }

      .bubble-content {
        max-width: unquote('min(420px, 100%)');
      }
    }
  }

  &.just-media {
    --message-time-background: var(--message-highlighting-color);

    .bubble-content {
      background: none!important;
      box-shadow: none;
    }

    img {
      object-fit: contain;
    }

    .time {
      inset-inline-end: 0;
    }
  }

  &.sticker,
  &.emoji-big:not(.sticker) {
    .bubble-content {
      align-self: flex-start;
    }

    .message {
      position: relative !important;
      margin-left: auto;
      right: 0 !important;
    }
  }

  &.sticker {
    .attachment {
      position: absolute;
      border-radius: 0;
      z-index: 1;
    }
  }

  &.round {
    .attachment {
      max-width: var(--round-video-size) !important;
      max-height: var(--round-video-size) !important;
      // border-radius: 50%;
      // width: var(--round-video-size) !important;
      // height: var(--round-video-size) !important;
    }

    .media-photo, 
    .media-video {
      border-radius: 50% !important;
      pointer-events: none;
    }
  }

  &:not(.emoji-big) .attachment {
    font-size: 0;
  }

  .attachment {
    max-width: 100%;
    border-start-start-radius: var(--border-start-start-radius);
    border-start-end-radius: var(--border-start-end-radius);
    border-end-start-radius: var(--border-end-start-radius);
    border-end-end-radius: var(--border-end-end-radius);
    overflow: hidden;
    user-select: none;

    //-webkit-mask-image: -webkit-radial-gradient(circle, white 100%, black 100%); // fix safari overflow
    
    display: flex; // lol
    justify-content: center;
    position: relative;
    cursor: pointer;
    
    img, 
    video {
      max-width: 100%;
    }

    .preloader-container {
      & ~ .video-play {
        display: none;
      }
    }

    &.no-background {
      background: none !important;
    }

    &.no-brt {
      --border-start-start-radius: 0;
      --border-start-end-radius: 0;
    }

    &.no-brb {
      --border-end-start-radius: 0;
      --border-end-end-radius: 0;
    }
  }

  &.must-have-name .attachment {
    --border-start-start-radius: 0;
    --border-start-end-radius: 0;
  }

  .media-container {
    &-aspecter {
      position: relative;
      margin: 0 auto;
      z-index: 1;
    }

    &-fitted {
      background-color: transparent !important;

      > .thumbnail {
        opacity: .8;

        &.fade-in {
          animation: thumbnail-fade-in-opacity .2s ease-in-out forwards;
        }
      }
    }
  }

  .preloader-container {
    z-index: 2;
  }

  &:not(.sticker) {
    .attachment {
      max-width: unquote('min(420px, 100%)');
      max-height: unquote('min(400px, 100%)');

      width: max-content;
    }
  }

  img:not(.emoji), 
  video {
    object-fit: cover;
    width: 100%;
    height: 100%;

    .is-safari & {
      border-radius: inherit;
    }
  }

  &.is-album {
    .attachment {
      max-width: unquote('min(451px, 100%)');
      max-height: none;
      //overflow: hidden;
    }
  }

  .album-item {
    background-color: var(--message-highlighting-color);
    max-width: 100%;
    cursor: pointer;
    position: absolute;
    overflow: hidden;

    @include animation-level(0) {
      transition: none !important;
    }

    /* .bubbles.is-selecting & {
      -webkit-mask-image: -webkit-radial-gradient(circle, white 100%, black 100%); // fix safari overflow
    } */

    &-media { // * fix overflow for handhelds
      border-radius: inherit;

      @include animation-level(0) {
        transition: none !important;
      }
    }

    .bubble-select-checkbox {
      bottom: auto !important;
      left: auto;
      right: .5rem;
      top: .5rem;
    }

    &.is-selected {
      border-radius: 0;
      
      .album-item-media {
        transform: scale(1);
      }

      &.animating {
        transition: border-radius var(--transition-standard-out);

        .album-item-media {
          transition: transform var(--transition-standard-out), border-radius var(--transition-standard-out);
        }
      }

      &:not(.backwards) {
        transition: border-radius var(--transition-standard-in);
        
        .album-item-media {
          transition: transform var(--transition-standard-in), border-radius var(--transition-standard-in);
          transform: scale(.883333);
        }

        &, .album-item-media {
          //border-radius: .5rem;
          border-radius: 0;
        }
      }
    }
  }

  .anchor-url:not(.reply-markup-button),
  .mention {
    @include hover() {
      text-decoration: underline !important;
    }
  }

  &-first {
    --border-start-start-radius: #{$bubble-border-radius-big};
    --border-start-end-radius: #{$bubble-border-radius-big};
    --border-end-end-radius: #{$bubble-border-radius-big};
    --border-end-start-radius: #{$bubble-border-radius-big};
    order: -1;
    margin-top: .5rem;
    justify-content: center;
    align-items: center;
    max-width: 100%;
    
    @include animation-level(0) {
      flex: 1 1 auto;
    }

    .attachment {
      pointer-events: none;
    }

    .bubble-content-wrapper {
      max-width: 100%;
    }

    &.empty-bubble-placeholder {
      position: absolute;
      top: 50%;
      // transform: translateY(-50%);
      left: 50%;
      transform: translate(-50%, -50%);

      @include animation-level(2) {
        .bubble-content-wrapper {
          transition: var(--bubble-transition-in);
        }
      }

      &.has-description {
        .service-msg {
          flex-direction: column;
          align-items: flex-start !important;
          padding: .75rem 1rem .875rem !important;
        }
  
        .center {
          align-self: center;
        }
  
        .empty-bubble-placeholder-title {
          font-weight: var(--font-weight-bold);
          font-size: 1rem !important;
        }

        .bubble-content {
          border-radius: 1.5rem !important;
        }
      }

      .empty-bubble-placeholder-line {
        color: #fff;
      }

      .empty-bubble-placeholder-line + .empty-bubble-placeholder-line {
        margin-top: .5rem;
      }

      .empty-bubble-placeholder-list-check {
        margin-right: .25rem;
        font-size: 1.25rem;
        vertical-align: bottom;
        margin-left: -.1875rem;
      }

      .empty-bubble-placeholder-list-bullet {
        margin-right: .3125rem;
      }

      .bubbles.has-groups & {
        pointer-events: none;
        
        .bubble-content-wrapper {
          transform: translateX(0) scale3d(.8, .8, 1);
          //transform: scale(.8) translateX(0);
          opacity: 0;
        }
      }

      &.empty-bubble-placeholder-group {
        .empty-bubble-placeholder-list-item {
          margin-top: .4375rem !important;
        }
      }

      &.empty-bubble-placeholder-greeting {
        &.wider {
          .service-msg {
            max-width: 272px;
          }
        }

        .service-msg {
          max-width: 232px;
        }

        .empty-bubble-placeholder-subtitle {
          margin-top: .25rem !important;
        }

        .has-service-before {
          margin-top: .5rem;
          border-radius: .875rem !important;

          .service-msg {
            max-width: 252px !important;
            padding: 0.28125rem 0.625rem !important;
          }
        }
      }

      &-premiumRequired, &-paidMessages {
        .service-msg {
          max-width: 200px;
        }

        .empty-bubble-placeholder-sticker {
          width: 8rem !important;
          height: 8rem !important;
          margin-left: auto;
          margin-right: auto;
          font-size: 128px;
          border-radius: 50%;
          background-color: rgba(var(--message-highlighting-color-rgb), 0.8);
        }

        .bubble-service-button {
          margin: 0 auto;
        }

        .empty-bubble-placeholder-stars {
          display: inline-flex;
          align-items: center;
          vertical-align: -0.2em;
          font-weight: 600;
          // line-height: 1em;
          height: 1em;
        }
        .empty-bubble-placeholder-star-icon {
          font-size: 16px;
        }
      }

      .empty-bubble-placeholder-sticker {
        margin-top: .75rem !important;
        margin-inline: auto;
        position: relative;
        width: 200px;
        height: 200px;
        cursor: pointer;
      }
    }

    .time {
      display: none !important;
    }

    &:before,
    &:after {
      display: none;
    }
  }

  .document {
    &-name {
      font-size: var(--messages-text-size);
    }

    &-size {
      font-size: var(--messages-secondary-text-size);
    }
  }

  &.is-square-photo {
    .bubble-content {
      width: fit-content;
    }
  }

  .reply.is-expired-story {
    .reply-subtitle {
      color: var(--primary-color);
    }
  }

  .reply {
    --font-size: var(--messages-secondary-text-size);
    // min-width: unquote("max(120px, calc(100% - 1rem))");
    // max-width: calc(100% - 1rem);
    margin: 0 $reply-padding-horizontal .5rem;

    &.mb-shorter {
      margin-bottom: -.125rem;
    }
  }

  &.just-media {
    .floating-part {
      --primary-color: #fff;
      --primary-color-rgb: 255, 255, 255;
      --ripple-color: rgba(var(--primary-color-rgb), .1);
      // padding: .375rem .5rem;
      border-radius: .25rem;
      position: absolute;
      top: 0;
      // margin-bottom: 0;
      margin: 0;
      background-color: var(--message-highlighting-color);
      white-space: nowrap;
      max-width: 15rem;

      @include respond-to(handhelds) {
        max-width: calc(100vw - #{$chat-padding-handhelds * 2} - 10px - 100%);
      }
    }

    .name {
      color: #fff !important;
      padding: .375rem .625rem;
      line-height: var(--line-height);

      // .peer-title {
      //   font-weight: var(--font-weight-normal) !important;
      //   // pointer-events: none;
      // }
    }

    .bubble-name-rank {
      display: none;
    }

    .reply {
      width: max-content;
      // @include respond-to(handhelds) {
      //   padding: 8px 6px 8px 8px;
      // }

      &-content {
        margin-top: 0;
        position: relative;
        max-width: none !important;
      }

      &-title,
      &-subtitle, 
      i {
        color: var(--primary-color) !important;
      }

      &-subtitle {
        overflow: hidden;
      }

      @include hover() {
        background-color: var(--message-highlighting-hover-color);
      }
    }

    .name-with-reply {
      border-radius: $bubble-border-radius-big;
      padding: .375rem .5rem;
    }
  }

  .message,
  .service-msg {
    --custom-emoji-size: var(--messages-custom-emoji-size);
  }

  .message {
    font-size: var(--messages-text-size);
    margin: $message-padding-top $message-padding-horizontal $message-padding-bottom;
    max-width: 100%;
    color: var(--primary-text-color);
    line-height: var(--line-height); // 21 / 16
    word-break: break-word;
    white-space: pre-wrap; // * fix spaces on line begin
    position: relative;

    .custom-emoji {
      display: inline-flex; // fix RTL thumb absolute position
    }

    &.mt-bigger {
      margin-top: $message-padding-horizontal;
    }

    &.mt-shorter {
      margin-top: #{$message-padding-top - 2px};
    }

    &.mb-shorter {
      margin-bottom: #{$message-padding-bottom - 2px};
    }

    &.margin-bigger {
      margin: $message-padding-horizontal;
    }

    &.is-hovering-spoiler {
      cursor: pointer;
    }
  }

  .next-is-message {
    margin-bottom: #{-$message-padding-top} !important;
  }

  // &.must-have-name,
  // &:not(.hide-name).is-group-first {
  //   .message.mt-off {
  //     margin-top: 0;
  //   }
  // }

  // @include respond-to(handhelds) {
  //   .document, 
  //   .audio {
  //     --icon-size: 2.25rem;
  //   }
  // }

  .audio {
    $parent: ".audio";
    #{$parent} {
      &-title {
        font-weight: var(--font-weight-bold);
      }

      &-ico {
        font-size: 0;
      }

      &-toggle {
        .part {
          background-color: var(--message-icon-text-color);
        }
      }
    }

    // @include respond-to(handhelds) {
    //   height: 2.375rem;
    //   --icon-margin: .6875rem;

    //   .audio-details {
    //     margin-top: 2px;
    //     margin-bottom: 0;
    //   }

    //   .audio-to-text-button {
    //     margin-top: -.875rem;
    //   }

    //   .audio-subtitle {
    //     margin-top: -1px;
    //   }

    //   /* &.corner-download .audio-download {
    //     margin: 1.375rem 1.375rem 0;
    //   } */
    // }
  }

  &.audio-message {
    --max-content-width: 335px;

    .audio {
      width: var(--max-content-width);
      max-width: 100%;
    }

    // @include respond-to(handhelds) {
    //   --max-content-width: 280px;
    // }
  }

  &.voice-message {
    --max-content-width: 364px;

    // @include respond-to(handhelds) {
    //   --max-content-width: 300px;
    // }

    .document-message {
      max-width: fit-content;
    }
  }

  &.min-content {
    .bubble-content {
      width: min-content;
    }
  }

  &.audio-message,
  &.voice-message,
  &.document-message {
    // .message {
    //   margin: 8px !important;
    // }

    // .time-inner {
    //   margin-bottom: -3px !important;
    // }

    .bubble-content > .name {
      margin-bottom: -.25rem;
    }
  }

  &.is-single-document {
    .document,
    .audio {
      margin-top: .5rem;
      margin-bottom: .5rem;
    }

    .document-message {
      margin-top: -.125rem;
    }

    .document {
      .time-inner {
        margin-bottom: -3px;
      }
    }
  }

  .message.expired-story-message {
    .reply {
      pointer-events: none;
      margin: 4px -4px 0 !important;
    }

    &.is-empty {
      .reply {
        margin-top: 0 !important;
        margin-right: 2.5rem !important;
        background-color: transparent;

        &-content {
          margin-inline-start: .375rem;
        }
      }

      .time {
        height: 0;
      }
    }
  }

  &.contact-message,
  &.call-message {
    --min-content-width: 200px;
  }

  &.contact-message {
    .contact {
      display: flex;
      padding: 2px 0;
      cursor: pointer;
      user-select: none;

      &-avatar {
        color: #fff;
      }

      &-details {
        padding-left: 12px;
        margin-top: 8px;
        display: flex;
        flex-direction: column;
      }

      &-name {
        font-size: 1rem;
        font-weight: var(--font-weight-bold);
      }

      &-number {
        font-size: 14px;
        line-height: 1.4;
        color: var(--message-status-color);
      }
    }
  }

  &.poll-message {
    --max-content-width: 400px;
  }

  &.document-message {
    --max-content-width: 325px;
  }

  &-call {
    cursor: pointer;
    padding: .125rem 0;
    padding-left: 2.5625rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    user-select: none;

    &-icon {
      position: absolute;
      left: .3125rem;
      font-size: 1.5rem;
    }

    &-title {
      font-weight: var(--font-weight-bold);
    }

    &-arrow {
      display: inline-block;
      transform: rotate(135deg);
      font-size: 1rem;

      &-red {
        color: var(--danger-color);
      }

      &-green {
        color: var(--message-out-primary-color);
      }
    }

    &-subtitle {
      font-size: var(--messages-secondary-text-size);
      color: var(--secondary-text-color);
      display: flex;
      align-items: center;
      margin-top: .0625rem;
      margin-left: -.1875rem;
      line-height: var(--messages-secondary-line-height);

      &.is-reason:before {
        margin-right: .0625rem;
      }
    }
  }

  .document-message {
    margin-top: .4375rem;
  }

  .document {
    --icon-margin: .75rem;

    // @include respond-to(handhelds) {
    //   --icon-margin: .5rem;

    //   .document-size {
    //     font-size: .75rem;
    //   }

    //   &:not(.document-with-thumb) .document-ico {
    //     padding: 1.125rem 0 0 0;
    //   }
    // }

    &-name {
      line-height: 1.4;
      margin-top: 1px;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .time {
      height: 0;
      align-self: flex-start;
    }
  }

  &.is-multiple-documents {
    .message {
      padding: 0 $message-padding-horizontal !important;
      margin: 0 !important;
      border-radius: inherit;
    }

    .reply {
      margin: 0 0 .5rem !important;
    }

    .document-container {
      position: relative;
      border-radius: inherit;
      padding: .25rem 0;

      .document-selection {
        position: absolute;
        top: 0;
        bottom: 0;
        z-index: -2;
        width: 200vw;
        left: -75vw;
      }

      &.is-highlighted, 
      &.is-selected {
        .document-wrapper {
          &:before {
            content: " ";
            position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            background-color: var(--message-background-color);
            border-radius: inherit;
            z-index: -1;
          }
        }
      }

      &.is-highlighted {
        .document-selection {
          background-color: var(--message-highlighting-color);
        }

        body:not(.animation-level-0) & {
          .document-selection/* , 
          .document-wrapper:before */ {
            animation: bubbleSelected 2s linear;
          }
        }
      }

      &.is-selected {
        .document-selection {
          background-color: var(--message-highlighting-color);
        }

        body:not(.animation-level-0) & {
          .document-selection/* , 
          .document-wrapper:before */ {
            animation: fade-in-opacity .2s linear forwards;
          }
  
          &.backwards {
            .document-selection/* , 
            .document-wrapper:before */ {
              animation: fade-in-backwards-opacity .2s linear forwards;
            }
          }
        }
      }

      .bubble-select-checkbox {
        --margin-top: .25rem;
        --margin-left: .125rem;
        left: auto;
        top: auto;
        background: #fff;
        border-radius: 50%;
        margin-left: calc(var(--padding-left) * -1 + var(--icon-size) - var(--size) + var(--margin-left));
        margin-top: calc(var(--icon-size) - var(--size) + var(--margin-top));

        @include respond-to(handhelds) {
          --size: 1.125rem;
          // left: 20px;
          // top: 25px;
        }

        &:before {
          --inner-size: .125rem;
          content: " ";
          position: absolute;
          width: calc(var(--size) - (var(--inner-size) * 2));
          height: calc(var(--size) - (var(--inner-size) * 2));
          left: var(--inner-size);
          top: var(--inner-size);
          border: 2px solid var(--secondary-color);
          border-radius: inherit;
        }
      }

      &.is-first {
        padding-top: .5rem;

        .document-selection {
          top: #{-$bubble-overflow}; // * padding inner + half padding outer
        }

        .document-wrapper {
          border-start-start-radius: inherit;
          border-start-end-radius: inherit;
        }
      }

      &.is-last {
        padding-bottom: $message-padding-bottom;

        .document,
        .audio {
          margin-bottom: #{8px - $message-padding-bottom};
        }

        .document-selection {
          bottom: #{-$bubble-overflow};
        }

        .document-wrapper {
          border-end-start-radius: inherit;
          border-end-end-radius: inherit;
        }
      }
    }

    &.is-group-first .document-container.is-first {
      .document-selection {
        top: #{-$bubble-overflow-big};
      }
    }

    &.is-group-last .document-container.is-last {
      .document-selection {
        bottom: #{-$bubble-overflow-big};
      }
    }

    .document-wrapper {
      > .name {
        margin: -.125rem 0 .25rem;
      }
    }

    // .document,
    // .audio {
    //   .time-inner {
    //     position: relative;
    //     bottom: 
    //   }
    // }

    .time-inner {
      margin-bottom: 5px !important;
    }

    .reactions-tag {
      margin-bottom: .125rem !important;
    }

    // .document-message {
    //   .time-inner {
    //     margin-bottom: -4px !important;
    //   }
    // }
  }

  .document {
    height: 54px !important;
    
    // @include respond-to(handhelds) {
    //   height: 38px !important;
    // }
  }

  .audio,
  &.poll-message, 
  &.contact-message {
    .time {
      position: absolute;
      right: 0;
      bottom: 0;
    }
  }

  .audio {
    .time {
      bottom: -3px;
    }
  }

  &.is-message-empty {
    .bubble-content-wrapper {
      width: min-content;
    }

    &:not(.emoji-big) {
      .reactions-like-block {
        max-width: fit-content;
      }
    }

    .reaction-like-block {
      --chosen-background-color: var(--primary-color);
    }

    .reaction-tag-dot {
      background-color: var(--counter-color) !important;
      opacity: .4;
    }

    .reaction-block.is-paid {
      --background-color: #fff6e3 !important;
    }

    .reaction-block {
      &:not(.is-chosen) {
        @include hover() {
          &:after {
            background-color: #fff;
          }
        }
      }
    }
  }

  &.with-reply-markup {
    .bubble-content {
      min-width: 100%;
    }
  }

  &.with-replies .attachment {
    border-end-start-radius: 0;
    border-end-end-radius: 0;
  }

  &.with-beside-replies .bubble-content {
    min-height: 5.5rem;
  }

  .colored-name {
    color: rgb(var(--peer-color-rgb)) !important;

    .premium-icon,
    .emoji-status-text-color {
      opacity: .6;
      color: inherit;
    }
  }
  
  .time {
    visibility: hidden; // * can't use color transparent here, because in name can be emoji
    font-size: var(--messages-time-text-size);
    height: var(--messages-time-text-size);
    user-select: none;
    line-height: 1;
    vertical-align: middle;
    pointer-events: none; // do not show title
    display: inline-flex;
    z-index: 1;
    /* display: inline-flex;
    align-items: center; */
    cursor: pointer;
    margin-inline-start: .1875rem;
    direction: ltr; // * rtl fix
    float: right;   // * rtl fix

    .is-rtl & {
      float: inline-end;
      direction: inherit;
    }

    &-sending-status {
      order: 5;
      font-size: calc(var(--messages-text-size) + 3px);
      //vertical-align: middle;
      // margin-left: 1px;
      line-height: var(--messages-time-text-size); // of message
      color: var(--message-status-color);
    }

    &-part {
      font-size: 1.125rem;
      margin-inline-end: .375rem;
    }

    &-pinned {
      margin-inline-end: .125rem;
    }

    &-icon {
      pointer-events: none;
      height: 1.125rem;

      &-views {
        margin-inline-start: 2px;
      }
    }

    &-edited {
      overflow: visible;
      font-size: inherit;
    }

    &-inner {
      pointer-events: all;
      position: absolute;
      // bottom: 0;
      inset-inline-end: 0;
      display: flex;
      align-items: center;
      line-height: 1;
      padding: inherit;
      white-space: nowrap;
      height: var(--messages-time-text-size); // * as font-size
      visibility: visible;
      color: var(--message-time-color);
      bottom: #{$message-padding-bottom - 6px};
    }

    &-replies {
      margin-inline-end: .375rem;
      order: -1;
      display: inline-flex;

      &-icon {
        margin-inline-start: .125rem;
        font-size: 12px;
        height: 12px;
      }
    }

    &-post-author {
      &-comma {
        float: inline-end;
        direction: ltr;
      }
    }

    &-effect {
      width: .75rem;
      height: .75rem;
      position: relative;
      margin-inline-end: .125rem;
    }

    &.is-block {
      float: none;
      display: block;
    }

    &.is-floating {
      margin-left: 0;
      display: flex;
      align-items: center;
      padding: 0 .3125rem !important;
      margin: 0 !important;
      white-space: nowrap;
      height: calc(var(--messages-time-text-size) + .375rem);
      max-width: inherit;
      position: absolute;
      bottom: .1875rem;
      right: .1875rem;
      z-index: 2;
      opacity: 1;

      @include animation-level(2) {
        transition: opacity var(--transition-standard-in);
      }

      .time-inner {
        color: #fff;
        margin: inherit;
        max-width: inherit;
        border-radius: .75rem;
        background-color: var(--message-time-background);
        // padding: 0 .3125rem;
        height: inherit;
        bottom: 0 !important;
      }

      .time-sending-status {
        color: currentColor;
      }

      .time-post-author {
        @include text-overflow();
      }
    }

    & + .clearfix {
      display: table;
    }
  }

  .clearfix {
    display: none;
  }

  &.has-webpage:not(.invert-media) .time {
    float: none;
  }

  &.with-replies:not(.sticker):not(.with-beside-replies) .time.is-floating {
    bottom: 53px;
  }

  &.sticker, 
  &.with-replies.round, 
  &.emoji-big {
    .time {
      bottom: 0 !important;
      inset-inline-end: 0 !important;
    }
  }

  .video-time, 
  .video-play {
    pointer-events: none;
  }

  .video-time {
    --height: calc(var(--messages-time-text-size) + .375rem);
    position: absolute;
    top: 3px;
    left: 3px;
    border-radius: var(--height);
    background-color: var(--message-time-background);
    padding: 0px 6px;
    z-index: 2;
    font-size: var(--messages-time-text-size);
    color: #fff;
    display: flex;
    align-items: center;
    user-select: none;
    height: var(--height);
    line-height: 1;
    opacity: 1;

    @include animation-level(2) {
      transition: opacity var(--transition-standard-in);
    }

    &-icon {
      // * same as .iconVolume
      order: 1;
      padding: 0 1px 0 3px;
      font-size: calc(var(--messages-time-text-size) + 8px);
      color: #fff;
    }

    &.is-error .video-time-icon {
      font-size: calc(var(--messages-time-text-size) + 4px);
      padding: 0;
      margin-inline-start: 1px;
    }

    &.other-side {
      left: auto;
      right: 3px;
    }
  }

  &.show-controls {
    .video-time {
      opacity: 0;
    }
  }

  // * mini player section

  &.show-controls .time.is-floating {
    opacity: 0;
  }

  .ckin__fullscreen {
    border: none !important;

    .media-photo {
      display: none;
    }

    .media-container-aspecter {
      width: 100% !important;
      height: 100% !important;
    }
  }

  .video-to-viewer {
    color: #fff;
    position: absolute;
    top: .125rem;
    inset-inline-end: .125rem;
    z-index: 2;
    background-color: var(--message-time-background);

    @include hover() {
      background-color: rgba(0, 0, 0, .6);
    }
  }

  // * mini player section end

  .anchor-url {
    text-decoration: underline;
  }

  .video-play {
    background-color: var(--message-time-background);
    color: #fff;
    text-align: center;
    font-size: 2.125rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
  }

  .peer-title {
    cursor: pointer;
    flex: 0 0 auto;
    max-width: 100%;
  }

  .name {
    margin: $message-padding-top $message-padding-horizontal 0;
    font-weight: var(--font-weight-bold) !important;
    color: rgb(var(--peer-color-rgb, var(--primary-color-rgb)));
    font-size: var(--messages-secondary-text-size);
    line-height: calc(var(--messages-secondary-text-size) + .25rem);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: none;

    .badge-fake {
      display: inline-block;
      vertical-align: text-bottom;
    }
  }

  &-name-forwarded {
    font-weight: var(--font-weight-normal);

    .peer-title {
      font-weight: var(--font-weight-bold);
    }

    &-avatar {
      display: inline-block;
      vertical-align: bottom;
      margin-inline-end: .25rem;
      cursor: pointer;
    }
  }

  .title-flex {
    display: flex;
    // align-items: center;
    max-width: inherit;
    overflow: inherit;
  }

  &-name-rank {
    color: var(--message-time-color);
    font-weight: var(--font-weight-normal);
    font-size: var(--messages-time-text-size);
    padding-inline-start: .25rem;
    margin-left: auto;
    order: 999;
    @include text-overflow();
  }

  &:not(.has-webpage) {
    &.photo, 
    &.video {
      &:not(.is-reply) .bubble-content > .name {
        margin-bottom: $message-padding-top;
      }

      .topic-name-button-container {
        margin-bottom: 0;
      }
    }
  }

  &:not(.has-webpage):not(.is-album):not(.sticker):not(.round):not(.emoji-big) .attachment {
    background-color: #000;
  }

  &:not(.sticker):not(.emoji-big):not(.forwarded) {
    &.hide-name, 
    &:not(.is-group-first) {
      .reply {
        margin-top: $reply-padding-top;
      }
    }
  }

  &.is-outgoing {
    .reactions {
      pointer-events: none;
    }
  }

  .bubble-tail {
    display: none;
  }

  &.can-have-tail {
    &.is-forced-rounded, &.is-group-last {
      .bubble-tail {
        position: absolute;
        bottom: 0;
        width: 11px;
        height: 20px;
        z-index: -2;
        display: block;
        fill: var(--message-background-color);
        transform: translateY(1px) scaleX(var(--reflect));
      }
    }
  }

  &.photo, 
  &.video {
    .attachment {
      border: 1px solid var(--message-background-color);
    }
  }

  &__media-container {
    cursor: pointer;
    border-radius: inherit;
  }

  audio-element, 
  poll-element {
    white-space: normal; // * fix due to .message white-space prewrap
  }

  .replies {
    user-select: none;

    .c-ripple__circle {
      background-color: var(--light-primary-color);
    }

    .rp {
      width: 100%;
      height: 100%;
      position: absolute;
      top: 0;
      left: 0;
      overflow: hidden;
      border-radius: inherit;
      cursor: pointer;
    }

    &-beside {
      flex-direction: column;
      width: 36px;
      min-height: 36px;
      height: auto;
      max-height: 52px;
      bottom: 47px; // * forward button + 9px margin
      border-radius: 2rem;
      right: -44px; // * because not 38px, as forward button
      padding: .375rem 0 .5rem;

      &-text {
        font-size: .75rem;
        margin-top: .125rem;
      }
    }

    &-footer {
      height: 3.0625rem;
      border-top: .0625rem solid var(--border-color);
      position: relative;
      display: flex;
      align-items: center;
      padding: 0 .5rem;
      border-end-start-radius: inherit;
      border-end-end-radius: inherit;
      color: var(--primary-color);
      min-width: 15rem;

      @include hover() {
        background-color: var(--light-primary-color);

        & ~ .bubble-tail {
          fill: var(--light-filled-message-primary-color);
        }

        // .tgico-next {
        //   animation: arrow-shake .3s ease-out forwards;
        // }
      }
  
      &-icon {
        font-size: 1.5rem;
        line-height: 1;
        height: 1.5rem;

        &-comments {
          margin-inline: .125rem .375rem;
        }

        &-next {
          position: absolute;
          inset-inline-end: .1875rem;
        }
      }

      &-text {
        font-weight: var(--font-weight-bold);
        font-size: .9375rem;
        margin-inline-start: .5rem;
        display: flex;
        align-items: center;
        color: var(--primary-color);
        line-height: 1.125rem;
      }
  
      &-avatars {
        --margin-right: -.875rem;
        --border-size: 2px;
      }
  
      &.is-unread {
        .replies-footer-text {
          &:after {
            content: " ";
            background-color: var(--primary-color);
            width: .5rem;
            height: .5rem;
            margin-inline-start: .75rem;
            border-radius: 50%;
          }
        }
      }
    }
  }

  &.is-thread-starter {
    .user-avatar {
      display: none;
    }

    &.is-in .bubble-content-wrapper {
      margin-left: 0;
    }
  }

  .message {
    .reaction {
      --background-color: var(--light-filled-message-primary-color);

      &:not(.is-chosen), 
      &.is-chosen.backwards {
        --counter-color: var(--message-primary-color);

        .stacked-avatars {
          --border-color: var(--background-color);
        }
      }
    }

    .reactions-tag {
      margin-bottom: .5rem;

      .time-inner {
        margin-bottom: -.1875rem;
      }
    }

    .reactions-like-block {
      .time {
        position: unset !important;
        right: auto !important;
        bottom: auto !important;
        order: 100;
        margin-top: .125rem;
      }
    }
  }

  .monospace-text {
    cursor: pointer;
  }

  &.is-invoice {
    .attachment {
      background-color: inherit !important;
    }
  }

  &.with-reply-markup {
    --border-end-start-radius: #{$bubble-border-radius-medium} !important;
    --border-end-end-radius: #{$bubble-border-radius-medium} !important;
  }

  .name-with-reply {
    .name {
      display: block;
      padding: 0 !important;
      margin: 0;

      &:not(:last-child) {
        .hide-ol {
          display: none;
        }

        .peer-title {
          font-weight: var(--font-weight-bold) !important;
        }
      }
    }

    .is-via {
      display: block;
      @include text-overflow();
    }

    .reply {
      margin: .25rem 0 0;
      padding: 0;
      width: auto;
      height: auto;
      max-height: none;
    }
  }

  .topic-name-button {
    --color: var(--message-primary-color);

    &.has-avatar {
      font-size: var(--messages-text-size);
      height: 1.875rem;
      padding-inline: 0 1.25rem;
      gap: .375rem;

      .topic-name-button-arrow {
        position: absolute;
        inset-inline-end: .125rem;
        color: currentColor;
        opacity: .4;
        font-size: 1rem;
      }

      .topic-name-button-avatar {
        position: relative;
      }
    }
  }

  .name .topic-name-button-container {
    margin: .25rem 0;
  }

  &.is-message-empty:not(.is-reply) .name .topic-name-button-container {
    margin-bottom: 0;
  }

  &:not(.is-group-first) .topic-name-button-container {
    display: none !important;
  }

  .topic-name-button-container.floating-part {
    padding-top: 0;
    padding-bottom: 0;
    font-size: var(--messages-secondary-text-size);

    .topic-name-button {
      --color: #fff;
      padding: 0;

      &:before {
        content: none;
      }
    }

    & + .floating-part {
      margin-top: 1.75rem;
    }
  }

  .audio-transcribed-text {
    margin-bottom: .75rem;
    margin-top: .25rem;

    &.is-error {
      color: var(--message-primary-color);
    }

    .audio-transcribing-dots {
      position: relative;

      &:before,
      &:after {
        content: "...";
      }

      &:before {
        opacity: 0;
      }

      &:after {
        position: absolute;
        right: 0;
        left: 0;
        animation: 1.5s linear audio-dots infinite;
      }
    }
  }

  .video-transcribed-text {
    margin-top: .25rem;
  }

  &.no-forwards {
    .bubble-beside-button.forward {
      display: none;
    }
  }

  &-service-button {
    min-height: 34px;
    font-weight: var(--font-weight-bold);
    background-color: rgba(var(--message-highlighting-color-rgb), .8);
    color: currentColor;
    padding: 0 1.25rem;
    border-radius: 34px;
    position: relative;
    margin-top: .625rem;
  }

  &-story-mention {
    &-wrapper {
      flex-direction: column;
      width: 184px;
      padding: 1.125rem 1rem .625rem !important;
      // padding-top: 1.125rem;
      // padding-bottom: 1rem !important;
    }

    &-avatar-container {
      position: relative;
      width: 100px;
      height: 100px;
      display: flex;
      cursor: pointer;
    }

    &-preview {
      position: absolute;
      top: 5.5px;
      right: 5.5px;
      bottom: 5.5px;
      left: 5.5px;
      border-radius: 50%;
      overflow: hidden;
      pointer-events: none;
      // cursor: pointer;
    }

    &-text {
      margin-top: .75rem;
    }
  }

  &.is-giveaway &-content {
    max-width: 20rem;
  }

  &-giveaway {
    text-align: center;
    padding: 0 1rem;
    max-width: 100%;
    line-height: calc(var(--font-size) + .25rem);
    white-space: pre-wrap;
    word-break: break-word;
    max-width: 16rem;
    margin: 0 auto .5rem;

    &-results &-sticker {
      margin-top: 1rem;
    }

    &-link {
      pointer-events: all;
      cursor: pointer;
    }

    &-sticker {
      margin: 0 auto;
      display: flex;
      justify-content: center;
      margin-top: -2rem;

      &-counter {
        background-color: var(--primary-color);
        color: var(--message-icon-text-color);
        border: 2px solid var(--message-background-color);
        border-radius: 1.5rem;
        height: 1.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 .375rem;
        position: absolute;
        bottom: 0;
        z-index: 1;
        font-weight: var(--font-weight-bold);
        font-size: calc(var(--font-size) - 2px);

        &-stars {
          background-color: #ffbc2e;
        }
      }
    }

    &-row {
      margin-top: .75rem;

      &-title {
        margin-bottom: .1875rem;
      }
    }

    &-channels {
      display: flex;
      gap: .375rem;
      justify-content: center;
      flex-wrap: wrap;
      margin-top: .375rem;
    }

    &-channel {
      margin: 0 !important;
      background-color: rgba(var(--peer-color-rgb), .1) !important;
      color: rgb(var(--peer-color-rgb)) !important;
      font-weight: var(--font-weight-bold);
      max-width: 100% !important;
      pointer-events: all;

      .is-out & {
        --peer-color-rgb: var(--message-out-primary-color-rgb) !important;
      }

      @include hover() {
        background-color: rgba(var(--peer-color-rgb), .2) !important;
      }
    }

    &-countries {
      margin-top: .25rem;
    }

    &-country {
      display: inline-flex;

      .emoji {
        line-height: inherit !important;
      }
    }

    &-and-more {
      margin-top: .375rem;
    }

    &-results {
      max-width: 20rem;
    }

    // .delimiter-with-text {
    //   margin-top: .125rem;
    // }
  }

  .verified-icon {
    width: 1.125rem;
    height: 1.125rem;
  }

  &.is-similar-channels {
    .bubble-content {
      &-wrapper {
        padding: 0 !important;
      }
    }
  }

  &-similar-channels {
    height: 0;
    overflow: hidden;

    // @include animation-level(2) {
    //   transition: height var(--transition-standard-in);
    // }

    // &.is-visible {
    //   height: 9.125rem;
    // }
  }

  &-sponsored {
    &-buttons {
      display: flex;
      flex-direction: column;
      width: 1.875rem;
      height: 4rem;
      border-radius: 15px;
      pointer-events: none;
      background-color: var(--message-highlighting-color) !important;
      padding: 2px 0;
      inset-block: 0;
      inset-inline-end: calc((1.875rem + .5rem) * -1);

      &-delimiter {
        position: absolute;
        width: 100%;
        height: 0.5px;
        background-color: #fff;
        opacity: .2;
        flex: 0 0 auto;
        justify-self: center;
      }

      &-button {
        width: 1.875rem;
        height: 1.875rem;
        color: #fff;
        font-size: 1.375rem;
        pointer-events: all;

        @include hover() {
          background-color: var(--message-highlighting-hover-color) !important;
        }
      }
    }
  }

  &:has(.reaction.is-paid.effect-active) {
    z-index: 3;
  }
}

.webpage {
  $parent: ".webpage";
  $webpage-padding: .375rem;
  $webpage-padding-vertical: .25rem;
  --secondary-color: var(--primary-color);
  --secondary-text-color: var(--primary-color);
  --link-color: var(--primary-color);
  --message-highlighting-color: rgba(var(--primary-color-rgb), .3);
  margin: .25rem 0;
  // max-width: 100%;
  font-size: var(--messages-secondary-text-size);
  line-height: var(--messages-secondary-line-height);
  text-decoration: none !important;
  color: var(--primary-text-color);
  display: block;

  & + .time {
    display: block;
    float: unset;
  }

  .audio-transcribed-text {
    margin-bottom: 0;
    order: 4;
  }

  .document {
    height: 3.375rem;

    // @include respond-to(handhelds) {
    //   padding-left: 44px;
    // }
  }

  .has-document {
    display: flex;
    flex-direction: column;
  }

  &.has-square-photo {
    #{$parent} {
      &-preview {
        // max-width: unquote('min(3rem, 100%)');
        // max-height: unquote('min(3rem, 100%)');
        max-width: 100%;
        max-height: 100%;
        margin: 0;

        &-resizer {
          width: 3rem;
          height: 3rem;
          float: inline-end;
          margin-inline-start: .625rem;
        }
      }
    }
  }

  &.no-text {
    margin-bottom: .75rem;
  }

  &-preview {
    max-width: unquote('min(420px, 100%)');
    max-height: unquote('min(380px, 100%)');
    border-radius: var(--border-radius);
    overflow: hidden;
    user-select: none;
    position: relative;
    width: max-content;

    img,
    video {
      max-width: 100%;
    }

    &-with-document {
      margin-bottom: 0 !important;
      min-width: 100%;
      overflow: unset;
    }

    &-with-document &-resizer {
      order: 1;
    }

    &-resizer {
      display: flex;
      margin: #{calc($webpage-padding-vertical - 1px)} 0;
      cursor: pointer;
    }

    &.is-round {
      .media-photo,
      .media-video {
        border-radius: 50%;
      }
    }
  }

  &-name,
  &-footer,
  .anchor-url {
    color: var(--primary-color);
  }

  .anchor-url,
  .mention {
    position: relative;
    z-index: 1;
  }

  &-name {
    display: block;

    .anchor-url {
      text-decoration: none !important;
    }

    &-tip {
      background-color: rgba(var(--primary-color-rgb), .12);
      border-radius: 13px;
      height: 15px;
      margin-inline-start: .4375rem;
      padding: 1.25px 5px;
      font-size: calc(var(--messages-text-size) - 5px);
      // line-height: 15px;
      pointer-events: all;
      cursor: pointer;
      position: relative;
      z-index: 1;
      vertical-align: top;
      user-select: none;
    }
  }

  &-text {
    word-break: break-word;

    // &-margin-top {
    //   margin-top: .125rem;
    // }

    // &-first-element {
    //   display: block;
    //   margin-top: -.3125rem;
    // }
  }

  &-quote {
    max-width: 100%;
    overflow: hidden;
    width: 100%;
    display: flex;
    // cursor: pointer;
  }

  &-content {
    flex: 1 1 auto;
    overflow: hidden;
    padding: $webpage-padding-vertical $webpage-padding;
    padding-inline-start: #{calc($webpage-padding + 3px)};

    &.min-content {
      min-width: 15rem;
      width: min-content;
    }
  }

  &-footer {
    $height: 2.25rem;
    $margin: .375rem;
    $border: .0625rem;
    margin-top: $margin;
    border-top: $border solid rgba(var(--primary-color-rgb, 0, 0, 0), .2);
    // text-transform: uppercase;
    position: relative;

    &-icon {
      position: absolute;
      right: -.125rem;
      top: .125rem;
      display: block;
    }

    &.is-link .webpage-footer-icon {
      transform: rotate(-45deg);
    }

    &.is-text {
      font-size: calc(var(--messages-text-size) - 4px);
      line-height: calc(var(--messages-text-size) - 1px);
      white-space: pre-wrap;
      padding: $margin 0 #{math.div($margin, 3)};
      @include text-overflow(false);
    }

    &.is-button {
      margin-bottom: #{-$webpage-padding-vertical};
      line-height: $height;
      font-size: var(--messages-text-size);
      text-align: center;
      font-weight: var(--font-weight-bold);
      height: #{$height + $margin + $border};
      padding: #{math.div($margin, 2)} .5rem 0;
      pointer-events: none;
      @include text-overflow(true);
    }
  }
}

.timestamp {
  text-decoration: underline;

  &.is-disabled {
    color: inherit;
    text-decoration: none !important;
    cursor: inherit;
  }
}

.geo {
  &-container {
    width: 23.25rem; // 372
    height: 16.375rem; // 262

    &.is-expired {
      .geo-live-pin {
        &-avatar {
          opacity: .5;
        }

        &-heading,
        &:before {
          display: none;
        }
      }
    }

    @include respond-to(handhelds) {
      width: 277px;
      height: 195px;
    }
  }

  &-svg {
    width: 100%;
    height: 100%;
    background-color: var(--message-background-color);

    &-path {
      fill: var(--dark-message-background-color);
    }
  }

  &-svg,
  &-image-container {
    pointer-events: none;
  }

  &-image {
    &-container {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
    }
  }

  &-live-pin {
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, .15));
    display: flex;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -100%);
    z-index: 1;

    &-avatar {
      position: relative;
      overflow: hidden;
      margin-right: 0;
      margin-bottom: 1.3125rem;
    }

    &-heading {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, 0.3125rem) rotate(var(--heading));
      transform-origin: bottom;
      width: 1.5rem;
      height: 2rem;
      clip-path: polygon(50% 100%, 0 0, 100% 0);
      background: radial-gradient(circle, var(--primary-color) -100%, transparent 100%);
      border-radius: 40%;

      @include animation-level(2) {
        transition: transform var(--transition-standard-in);
      }
    }

    &-svg {
      fill: #fff;
      position: absolute;
      left: 50%;
      bottom: 0;
      transform: translate(-50%, 0);
      width: 5rem;

      bottom: 0.5rem;
    }

    &:before,
    &:after {
      content: "";
      position: absolute;
      bottom: 0;
      left: 50%;
      transform: translate(-50%, 50%);
      border-radius: 50%;
    }

    &:before {
      width: var(--accuracy-size);
      height: var(--accuracy-size);

      @include animation-level(2) {
        animation: accuracy-wave 5s ease-out infinite forwards;
      }

      @keyframes accuracy-wave {
        0% {
          transform: translate(-50%, 50%) scale(0);
          background-color: var(--primary-color);
        }

        100% {
          transform: translate(-50%, 50%) scale(1);
          background-color: transparent;
        }
      }
    }

    &:after {
      border: 2px solid #fff;
      background-color: var(--primary-color);
      // z-index: 3;
      width: 1rem;
      height: 1rem;
    }
  }

  &-pin {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    margin-top: -1.625rem;
    width: 2rem;
    height: 3.25rem;
  }

  &-footer {
    display: flex;
    flex-direction: column;
    min-height: 2.5rem;

    &-title {
      font-weight: var(--font-weight-bold);
    }

    &-address {
      color: var(--message-time-color);
      font-size: var(--messages-secondary-text-size);
      line-height: var(--messages-secondary-line-height);
    }

    &-timer {
      position: absolute;
      top: 50%;
      right: .1875rem;
      transform: translateY(-50%);
      width: 1.875rem;
      height: 1.875rem;

      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--message-primary-color);
      font-weight: var(--font-weight-bold);
      font-size: calc(var(--messages-text-size) - 3px);
      white-space: nowrap;

      &-svg {
        position: absolute;
        top: 0;
        left: 0;
        fill: none;
      }

      &-circle {
        stroke: var(--message-primary-color);
        stroke-width: 2;
        stroke-linecap: round;

        &-shadow {
          opacity: .2;
        }
      }
    }

    &.is-live {
      position: relative;
      padding-right: 3rem;
    }
  }
}

@keyframes audio-dots {
  0% {
    content: "";
  }

  33% {
    content: ".";
  }

  66% {
    content: "..";
  }

  100% {
    content: "...";
  }
}

// @keyframes arrow-shake {
//   0% {
//     transform: translateX(0);
//   }

//   25% {
//     transform: translateX(-.25rem);
//   }

//   75% {
//     transform: translateX(.125rem);
//   }

//   100% {
//     transform: translateX(0);
//   }
// }

// * fix scroll with only 1 bubble
.bubbles-group-last {
  .bubble.is-group-last {
    // margin-bottom: $bubble-overflow;
    margin-bottom: 0;
    /* &:after, .document-container:last-of-type .document-selection {
      bottom: 0 !important;
    } */

    &:after,
    .document-container.is-last .document-selection {
      bottom: #{-$bubble-overflow};
    }
  }
}

// .bubble-content-wrapper,
// .bubbles-group-avatar,
.can-zoom-fade {
  transform: scale(1) translateX(0);
  transform-origin: center;
  opacity: 1;

  @include animation-level(2) {
    transition: var(--bubble-transition-in) !important;
  }

  &.zoom-fade /* .bubble-content */ {
    transform: scale3d(.8, .8, 1) translateX(0);
    //transform: scale(.8) translateX(0);
    opacity: 0;
  }
}

.bubble-content-wrapper {
  display: flex;
  flex-direction: column;
  max-width: unquote('min(var(--max-content-width, 100%), var(--max-width))');
}

.bubble.service {
  align-self: center;
  justify-content: center;

  b {
    color: inherit;
  }

  .bubble-content {
    background-color: transparent;
    border-radius: .875rem;

    &-wrapper {
      max-width: 100%;
      padding: 0 2rem;
    }
  }  
}

.bubble.service, .bubble.has-fake-service {
  .service-msg {
    color: #fff;
    //background-color: rgba(0, 0, 0, .24);
    background-color: var(--message-highlighting-color);
    font-size: var(--messages-service-text-size);
    padding: .28125rem .625rem;
    // padding: .1875rem .5rem;
    // line-height: var(--line-height);
    line-height: calc(var(--messages-service-text-size) + 5px);
    // line-height: normal;
    border-radius: inherit;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    word-break: break-word;

    .expired-story-icon {
      margin-top: -4px;
    }

    i {
      font-style: normal;
    }

    a {
      color: #fff;
    }

    a, 
    .peer-title,
    [data-saved-from] {
      cursor: pointer;
      font-weight: var(--font-weight-bold);

      &:hover {
        text-decoration: underline;
      }
    }

    .emoji-image {
      margin-bottom: 3px;
    }
  }

  .reactions-like-block {
    justify-content: center;
  }
}

.message-action-icon {
  margin-right: 0.25rem;
  margin-bottom: 2.5px;
  vertical-align: bottom;
  display: inline-block;
}

.bubble.has-fake-service {
  padding-top: 2.625rem;
  position: relative;

  .service-msg {
    position: absolute;
    left: 50%;
    top: 6px;
    transform: translateX(-50%);

    max-width: 100%;
    border-radius: #{$bubble-border-radius-big};
    
    display: block;
    text-align: left;
    text-wrap: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.bubble.service.is-reply .service-msg {
  cursor: pointer;
}

.bubble.is-in {
  --border-start-start-radius: #{$bubble-border-radius-medium};
  --border-start-end-radius: #{$bubble-border-radius-big};
  --border-end-end-radius: #{$bubble-border-radius-big};
  --border-end-start-radius: #{$bubble-border-radius-medium};

  .bubble-content {
    &-wrapper {
      &.can-zoom-fade {
        transform-origin: var(--transform-origin-left-center);
      }
    }
  }

  &.is-group-first, &.is-forced-rounded {
    --border-start-start-radius: #{$bubble-border-radius-big};
  }

  &.is-group-last, &.is-forced-rounded {
    &.can-have-tail {
      --border-end-start-radius: 0 !important;

      .bubble-tail {
        margin-inline-start: -8.4px;
      }

      &.has-plain-media-tail {
        .attachment {
          border-end-start-radius: $bubble-border-radius-big;
        }
      }
  
      /* .bubble-content:after {
        margin-left: -8.4px;
        background-image: url('assets/img/msg-tail-left.svg');
      } */
    }

    &:not(.can-have-tail) {
      --border-end-start-radius: #{$bubble-border-radius-big};
    }
  }

  &.just-media {
    .floating-part {
      left: calc(100% + 10px);

      @include respond-to(handhelds) {
        left: calc(100% + 1px);
      }
    }
  }
  
  .reply-title {
    color: var(--primary-color);
  }
  
  .time {
    margin-inline-start: 5px;

    // &-inner {
    //   margin-bottom: -1px;
    // }
  }

  .audio-subtitle, 
  .contact-number, 
  .audio-time {
    color: var(--secondary-text-color) !important;
  }

  /* .poll {
    &-answer-selected {
      &:before {
        margin-left: -1px;
      }
    }
  } */

  .monospace-text {
    color: rgb(var(--peer-color-rgb));
  }
}

.bubble.is-out {
  flex-direction: row-reverse;
  --message-background-color: var(--message-out-background-color);
  --light-message-background-color: var(--light-message-out-background-color);
  --light-filled-message-background-color: var(--light-filled-message-out-background-color);
  --dark-message-background-color: var(--dark-message-out-background-color);
  --message-icon-text-color: var(--message-out-icon-text-color);
  --link-color: var(--message-out-link-color);
  --message-primary-color: var(--message-out-primary-color);
  --message-primary-color-rgb: var(--message-out-primary-color-rgb);
  --light-filled-message-primary-color: var(--light-filled-message-out-primary-color);
  --selection-background-color: var(--message-out-selection-background-color);
  --message-time-color: var(--message-out-time-color);
  --message-status-color: var(--message-out-status-color);
  --link-color: var(--message-primary-color);
  --peer-color-rgb: var(--message-primary-color-rgb);
  --peer-border-background: var(--message-out-peer-border-background);
  --message-reaction-tag-dot-color: var(--message-out-reaction-tag-dot-color);
  --border-start-start-radius: #{$bubble-border-radius-big};
  --border-start-end-radius: #{$bubble-border-radius-medium};
  --border-end-end-radius: #{$bubble-border-radius-medium};
  --border-end-start-radius: #{$bubble-border-radius-big};

  .bubble-content {
    margin-left: auto;

    &, 
    .poll-footer-button {
      border-start-start-radius: var(--border-start-start-radius);
      border-start-end-radius: var(--border-start-end-radius);
      border-end-end-radius: var(--border-end-end-radius);
      border-end-start-radius: var(--border-end-start-radius);
    }

    .name {
      color: var(--message-out-primary-color);
    }

    /* html:not(.is-firefox) */ &-wrapper {
      &.can-zoom-fade {
        transform-origin: var(--transform-origin-right-center);
      }

      @include respond-to(medium-screens) {
        transform: translateX(calc((var(--chat-input-size) + #{$btn-send-margin}) * var(--reflect) * -1)) scale(1);

        &.zoom-fade {
          transform: translateX(calc((var(--chat-input-size) + #{$btn-send-margin}) * var(--reflect) * -1)) scale3d(.8, .8, 1);
        }

        @include animation-level(2) {
          transition: var(--bubble-transition-out);
        }

        //@include respond-to(no-floating-left-sidebar) {
          body.is-right-column-shown & {
            transform: translateX(0) scale(1);
            
            @include animation-level(2) {
              transition: var(--bubble-transition-in);
            }
  
            &.zoom-fade {
              transform: translateX(0) scale3d(.8, .8, 1);
            }
          }
        //}
      }
    }
  }

  /* .bubble-content-wrapper {
    > .user-avatar {
      left: auto;
      right: -2.5rem;
    }
  } */
    
  &.is-group-first, &.is-forced-rounded {
    --border-start-end-radius: #{$bubble-border-radius-big};
  }

  &.is-group-last, &.is-forced-rounded {
    &.can-have-tail {
      --border-end-end-radius: 0 !important;

      .bubble-tail {
        inset-inline-end: -8.4px;
        transform: translateY(1px) scaleX(calc(var(--reflect) * -1));
      }

      &.has-plain-media-tail {
        .attachment {
          border-end-end-radius: $bubble-border-radius-big;
        }
      }
      
      /* .bubble-content:after {
        right: -8.4px;
        background-image: url('assets/img/msg-tail-right.svg');
      } */
    }

    &:not(.can-have-tail) {
      --border-end-end-radius: #{$bubble-border-radius-big};
    }
  }

  &.just-media {
    .floating-part {
      inset-inline-end: calc(100% + 10px);
    }
  }

  .time {
    &-inner {
      margin-inline-end: -2px;
    }
  }

  &.forwarded {
    .name {
      color: var(--message-out-primary-color);
    }
  }

  &.is-error {
    .time-sending-status {
      color: var(--message-error-color);
    }
  }

  .document-ico:after {
    border-top-color: var(--message-background-color);
    border-right-color: var(--message-background-color);
  }

  &.is-message-empty {
    .reactions-like-block {
      --margin-horizontal: .25rem;
      justify-content: flex-end;
      position: relative;
      margin-top: unset;
    }

    .reactions-renderer {
      inset: 0 !important;
    }

    .reaction-like-block {
      &.is-chosen {
        --chosen-background-color: var(--surface-color);
        --counter-color: var(--primary-color);
      }
    }

    &:not(.emoji-big) {
      .reactions-like-block {
        margin-inline-start: auto;
      }
    }
  }

  .bubble-call-arrow {
    transform: rotate(-45deg);
  }

  poll-element {
    .poll {
      &-answer-selected {
        color: var(--message-out-icon-text-color);
      }

      html.no-touch &-answer:hover {
        .animation-ring {
          background-color: var(--message-out-primary-color);
          opacity: .08;
        }
      }

      &-avatars {
        .stacked-avatars {
          --border-color: var(--message-background-color);
        }
      }
    }

    .progress-ring__circle {
      stroke: var(--message-out-primary-color);
    }

    .c-ripple__circle {
      background-color: var(--message-out-primary-color);

      &:not(.hiding) {
        opacity: .08;
      }
    }
  }

  &.is-sending poll-element {
    pointer-events: none;
  }

  .audio {
    .progress-line {
      &:before, 
      &__loaded {
        opacity: .1;
        background-color: var(--primary-color);
      }
    }
  }

  .bubble-beside-button {
    inset-inline: var(--message-beside-button-margin) auto;
    //transform: scaleX(-1);

    &.goto-original {
      transform: rotate(180deg);
    }
  }

  &.is-multiple-documents {
    .document-container {
      .bubble-select-checkbox {
        background-color: var(--message-background-color);

        &:before {
          border-color: var(--dark-message-background-color);
        }

        .checkbox-box-border {
          border-color: var(--message-background-color);
        }
      }

      /* &:after {
        left: -50vw;
      } */
    }
  }

  .bubble-hover-reaction {
    inset-inline: var(--offset) auto;
  }

  .code {
    .night & {
      --primary-color-rgb: var(--message-out-background-color-rgb);
      --primary-color: #fff;
    }
  }

  .monospace-text {
    color: var(--message-time-color);
  }
}

.reply-markup {
  width: 100%;
  margin-top: .0625rem;

  .bubble:not(.is-group-last) & {
    margin-bottom: $bubble-margin;
  }

  &-row {
    margin-top: $bubble-margin;
    overflow: hidden;
    min-height: 2.5rem;
    display: flex;
    gap: $bubble-margin;
  }

  &-button {
    padding: .5625rem 0;
    border-radius: .375rem;
    z-index: 2;
    font-size: var(--font-size-14);
    user-select: none;
    text-align: center;
    color: #fff !important;
    outline: none;
    border: none;
    width: 100%;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    //line-height: var(--line-height);
    background: var(--message-highlighting-color);
    font-weight: var(--font-weight-bold);

    &.is-first {
      border-end-start-radius: $border-radius-big;
    }

    &.is-last {
      border-end-end-radius: $border-radius-big;
    }

    &-text {
      position: relative;
      pointer-events: none;
    }

    &.anchor-url {
      text-decoration: none !important;
    }

    &-icon {
      position: absolute;
      right: .125rem;
      top: .125rem;
      display: block;
    }

    &.is-link .reply-markup-button-icon {
      transform: rotate(-45deg);
    }
  }
}

.reply-markup-button,
.bubble-beside-button,
.bubble-service-button {
  // &:after {
  //   display: block;
  //   position: absolute;
  //   top: 0;
  //   right: 0;
  //   bottom: 0;
  //   left: 0;
  //   border-radius: inherit;
  //   opacity: 0;
  //   z-index: -1;
  //   background-color: #fff;
  // }

  @include hover() {
    background-color: var(--message-highlighting-hover-color);
    // &:after {
    //   content: " ";
    //   opacity: var(--hover-alpha);
    // }
  }
}

.bubble-primary-color {
  color: var(--message-primary-color);
  font-weight: var(--font-weight-bold);
}

.transcribe-button-spinner-svg {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;

  circle {
    transform-origin: 50% 50%; /* Center rotation */
    animation: transcribe-button-spinner-animation 1s linear infinite, transcribe-button-spinner-length-animation 1.2s linear infinite alternate;
  }
}


@keyframes transcribe-button-spinner-animation {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes transcribe-button-spinner-length-animation {
  0% {
    stroke-dasharray: 0 65.97;
  }
  100% {
    // stroke-dasharray: calc(var(--PI) * var(--radius)) calc(var(--PI) * var(--radius));
    stroke-dasharray: 32.98 32.98;
  }
}

.inline-stars {
  display: inline-flex;
  align-items: center;

  .tgico {
    line-height: unset;
  }

  &--reversed {
    vertical-align: -0.175em;
    flex-direction: row-reverse;
  }
}

.bubble-meta-inline-stars {
  margin-right: 6px;
}

.unknown-user-bubble {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  margin: 0;

  .bubble-content,
  .bubble-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
}

.bubble .bubble.is-sponsored {
  margin-top: 0.25rem;
  --border-end-start-radius: 0;
}
