.Message {
  position: relative;

  & + & {
    margin-top: var(--gutter);
  }
  &.left {
    .Message-main {
      & > .Avatar {
        margin-right: var(--msg-avatar-gap);
      }
    }
    .Bubble {
      margin-right: var(--msg-gutter);
    }
  }
  &.right {
    .Message-main,
    .Message-content {
      flex-direction: row-reverse;
    }
    .Message-main {
      & > .Avatar {
        margin-left: var(--msg-avatar-gap);
      }
    }
    .Message-author {
      text-align: right;
    }
    .Bubble {
      margin-left: var(--msg-gutter);
      background: var(--brand-3);
    }
  }
  &.pop {
    display: none;
  }
}

.Message-meta {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
  text-align: center;
}

.Message-main > .Avatar {
  --avatar-size: var(--rate-width);
}

.Message-main,
.Message-content {
  display: flex;
  align-items: flex-start;
}

.Message-inner {
  flex: 1;
  min-width: 0;
}

.Message-author {
  margin-bottom: 6px;
  color: var(--color-text-2);
  font-size: var(--font-size-xs);
  line-height: 1.1;
}

// SystemMessage
.SystemMessage {
  padding: 0 15Px;
  color: var(--color-text-2);
  text-align: center;

  .Btn {
    margin-left: 6px;

    &:disabled {
      color: var(--color-text-3);
      opacity: 1;
    }
  }
}

.SystemMessage-inner {
  position: relative;
  display: inline-block;
  padding: 6Px 9Px;
  font-size: 12Px;
  text-align: left;
  border-radius: var(--radius-md);

  &::before {
    content: '';
    position: absolute;
    background: var(--color-fill-1);
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    opacity: 0.7;
    z-index: 0;
  }

  .Btn,
  span {
    z-index: 1;
    position: relative;
    vertical-align: top;
  }
}

html[data-color-scheme="dark"] {
  .SystemMessage-inner {
    background: var(--color-fill-2);

    &::before {
      content: none;
    }
    span {
      position: static;
    }
  }
}

.ChatApp[data-elder-mode="true"] {
  .SystemMessage-inner {
    padding: 7Px 14Px;
    font-size: 14Px;
  }
}
