/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;0,1000;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900;1,1000&display=swap');

/*********************
 * slime2 containers *
 *********************/

/* Container for the slime2 system */
#slime2-root {
  position: absolute;
  inset: 0;
  overflow: hidden;
  --textColor: #817253;
  --backgroundColor: #fef9e0;
  --backgroundOpacity: 1;
}

/* Container for the chat message list from slime2 */
#slime2-event-list {
  display: flex;
  overflow: hidden;
  gap: 30px;
  position: absolute;
  line-height: 30px;
  font-family: var(--otherFontName), Nunito, Helvetica, Arial, sans-serif;
  font-size: var(--otherFontSize);
  font-weight: var(--otherFontWeight);
  color: white;
  padding: 20px;
  width: 100%;
  height: 100%;
}

/* Container for each chat message from slime2 */
.slime2-event {
  flex-shrink: 0;
}

/* Message container */
.message {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  --nameplateTextColor: var(--villagerTextColor);
  --nameplateBackgroundColor: var(--villagerBackgroundColor);
}

.nameplate-custom .message {
  --nameplateTextColor: var(--nameplateCustomTextColor);
  --nameplateBackgroundColor: var(--nameplateCustomBackgroundColor);
}

.animate-exit.message {
  animation: exit 0.3s forwards;
}

.message-basic,
.message-reply {
  --textColor: var(--basicTextColor);
  --backgroundColor: var(--basicBackgroundColor);
  --backgroundOpacity: var(--basicBackgroundOpacity);
}

.message-action {
  --textColor: var(--actionTextColor);
  --backgroundColor: var(--actionBackgroundColor);
  --backgroundOpacity: var(--actionBackgroundOpacity);
}

.message-announcement {
  --textColor: var(--announcementTextColor);
  --backgroundColor: var(--announcementBackgroundColor);
  --backgroundOpacity: var(--announcementBackgroundOpacity);
}

.message-cheer {
  --textColor: var(--cheerTextColor);
  --backgroundColor: var(--cheerBackgroundColor);
  --backgroundOpacity: var(--cheerBackgroundOpacity);
}

.message-highlight {
  --textColor: var(--highlightTextColor);
  --backgroundColor: var(--highlightBackgroundColor);
  --backgroundOpacity: var(--highlightBackgroundOpacity);
}

.message-redeem {
  --textColor: var(--redeemTextColor);
  --backgroundColor: var(--redeemBackgroundColor);
  --backgroundOpacity: var(--redeemBackgroundOpacity);
}

.message-resub {
  --textColor: var(--resubTextColor);
  --backgroundColor: var(--resubBackgroundColor);
  --backgroundOpacity: var(--resubBackgroundOpacity);
}

/***************************
 * Avatar Container Styles *
 ***************************/

.avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  position: relative;
}

.hide-villagers .avatar {
  display: none;
}

/* Image styles */

.avatar-image {
  height: 50px;
  width: 50px;
  z-index: 1;
}

.punctuation-image {
  display: none;
  position: absolute;
  top: -15px;
  height: 30px;
  width: 30px;
  z-index: 2;
  transform-origin: bottom;
}

.show-exclamation-image .punctuation-image-exclamation {
  display: block;
  content: var(--exclamationImage);
  animation: 0.3s exclamation forwards linear;
}

.show-question-image .punctuation-image-question {
  display: block;
  content: var(--questionImage);
  animation: 0.3s question forwards linear;
}

.role-image {
  position: absolute;
  display: none;
  width: 25px;
  height: 25px;
  z-index: 2;
}

.avatar .role-image {
  bottom: 0px;
  right: -10px;
  animation: item 2.25s both infinite linear;
}

.user .role-image {
  top: 50%;
  transform: translateY(-50%);
  left: -25px;
}

.role-position-avatar .user .role-image {
  display: none !important;
}

.role-position-username .avatar .role-image {
  display: none !important;
}

.show-subscriber-image .role-subscriber .role-image {
  display: block;
  content: var(--subscriberImage);
}

.show-vip-image .role-vip .role-image {
  display: block;
  content: var(--vipImage);
}

.show-artist-image .role-artist .role-image {
  display: block;
  content: var(--artistImage);
}

.show-moderator-image .role-moderator .role-image {
  display: block;
  content: var(--moderatorImage);
}

.show-broadcaster-image .role-broadcaster .role-image {
  display: block;
  content: var(--broadcasterImage);
}

/* Pronouns styles */
.pronouns {
  line-height: 1em;
  border-radius: 100px;
  padding: 3px 5px;
  position: absolute;
  bottom: -13px;
  color: var(--nameplateTextColor);
  background-color: var(--nameplateBackgroundColor);
}

.pronouns-lowercase :is(.pronouns, .pronouns-inline) {
  text-transform: lowercase;
}

.pronouns-uppercase :is(.pronouns, .pronouns-inline) {
  text-transform: uppercase;
}

:is(.pronouns, .pronouns-inline):empty {
  display: none;
}

.pronouns-inline::before {
  content: ' (';
}

.pronouns-inline::after {
  content: ')';
}

.pronouns-avatar .pronouns-inline,
.pronouns-username .pronouns {
  display: none;
}

/***************************
 * Bubble Container Styles *
 ***************************/

.bubble {
  display: flex;
  flex-direction: column;
  position: relative;
  animation: enter 0.3s forwards;
}

.bubble-background {
  opacity: var(--backgroundOpacity);
}

.background-box {
  position: absolute;
  inset: 0;
  background-color: var(--backgroundColor);
  border-radius: 25px / 20px;
  border-top-left-radius: 30px 25px;
  border-top-right-radius: 30px 25px;
  animation: background-wobble 4s both infinite;
  transform: translateY(5px);
}

.background-tail {
  position: absolute;
  bottom: 5px;
  height: 12px;
  width: 15px;
  overflow: hidden;
}

.background-tail::after {
  content: '';
  position: absolute;
  bottom: 0;
  height: 15px;
  width: 15px;
  box-shadow: 0 0 0 10px var(--backgroundColor);
}

/***************
 * User Styles *
 ***************/

/* Container for username nameplate */
.user {
  margin-top: -15px;
}

/* Text of the nameplate */
.user-text {
  line-height: 1em;
  border-radius: 100px;
  padding: 4px 7px;
  color: var(--nameplateTextColor);
  background-color: var(--nameplateBackgroundColor);
}

/**************************
 * Message Content Styles *
 **************************/

/* Content container */
.content {
  overflow-wrap: anywhere;
  align-items: center;
  color: var(--textColor);
  font-size: var(--fontSize);
  font-weight: var(--fontWeight);
  font-family: var(--fontName), Nunito, Helvetica, Arial, sans-serif;
  padding-bottom: 5px;
  padding-left: 20px;
  padding-right: 20px;
  position: relative;
}

.message-action .text {
  font-style: italic;
}

.emote {
  height: 1.75em;
  max-height: 112px;
  display: inline-block;
  vertical-align: middle;
  margin-top: -0.25em;
  margin-bottom: -0.2em;
}

.redeem-wrapper {
  display: flex;
  justify-content: flex-end;
}

.redeem {
  font-size: var(--otherFontSize);
  font-weight: var(--otherFontWeight);
  font-family: var(--otherFontName), Nunito, Helvetica, Arial, sans-serif;
  text-align: right;
  display: block;
  line-height: 1em;
  border-radius: 100px;
  padding: 4px 7px;
  color: var(--nameplateTextColor);
  background-color: var(--nameplateBackgroundColor);
}

.show-action-image .message-action .message-type-image {
  display: block;
  content: var(--actionImage);
}

.show-announcement-image .message-announcement .message-type-image {
  display: block;
  content: var(--announcementImage);
}

.show-cheer-image .message-cheer .message-type-image {
  display: block;
  content: var(--cheerImage);
}

.show-highlight-image .message-highlight .message-type-image {
  display: block;
  content: var(--highlightImage);
}

.show-redeem-image .message-redeem .message-type-image {
  display: block;
  content: var(--redeemImage);
}

.show-resub-image .message-resub .message-type-image {
  display: block;
  content: var(--resubImage);
}

/***********************
 * Dynamic Emote Sizes *
 ***********************/

.dynamic-emote-sizes .emote-2 .emote {
  height: var(--emoteMedium);
}

.dynamic-emote-sizes .emote-4 .emote {
  height: var(--emoteLarge);
}

/*******************************************************
 * Event List Axis (Vertical/Horizontal) and Alignment *
 *******************************************************/

/* Apply these classes to main in the HTML */

.vertical-top-left {
  flex-direction: column-reverse;
  justify-content: start;
  align-items: flex-start;
}

.vertical-top-right {
  flex-direction: column-reverse;
  justify-content: start;
  align-items: flex-end;
}

.vertical-bottom-left {
  flex-direction: column;
  justify-content: end;
  align-items: flex-start;
}

.vertical-bottom-right {
  flex-direction: column;
  justify-content: end;
  align-items: flex-end;
}

.horizontal-top-left {
  flex-direction: row-reverse;
  justify-content: start;
  align-items: flex-start;
}

.horizontal-top-right {
  flex-direction: row;
  justify-content: end;
  align-items: flex-start;
}

.horizontal-bottom-left {
  flex-direction: row-reverse;
  justify-content: start;
  align-items: flex-end;
}

.horizontal-bottom-right {
  flex-direction: row;
  justify-content: end;
  align-items: flex-end;
}

[class*='random-'] .message {
  --randomVisibility: hidden;
  --randomTop: 0;
  --randomLeft: 0;
  position: absolute;
  top: var(--randomTop);
  left: var(--randomLeft);
  visibility: var(--randomVisibility);
  z-index: 10;
}

:is([class*='horizontal-'], [class*='random-']) .message {
  max-width: var(--maxWidth);
}

#slime2-event-list[class*='-right']
  :is(
    .switch-subscriber .role-subscriber,
    .switch-vip .role-vip,
    .switch-artist .role-artist,
    .switch-moderator .role-moderator,
    .switch-broadcaster .role-broadcaster
  ) {
  align-self: flex-start;
}

#slime2-event-list[class*='-left']
  :is(
    .switch-subscriber .role-subscriber,
    .switch-vip .role-vip,
    .switch-artist .role-artist,
    .switch-moderator .role-moderator,
    .switch-broadcaster .role-broadcaster
  ) {
  align-self: flex-end;
}

/********************
 * Avatar Alignment *
 ********************/

/* avatar to the left side of the message */

#slime2-event-list[class*='-left'] .message {
  flex-direction: row;
}

#slime2-event-list[class*='-left'] .background-tail {
  left: -8px;
  border-bottom-right-radius: 10px;
  transform: translateY(0) rotate(60deg);
  animation: tail-left 4s both infinite;
}

#slime2-event-list[class*='-left'] .background-tail::after {
  left: -10px;
  border-bottom-right-radius: 10px;
}

#slime2-event-list[class*='-left'] :is(.message.exist, .bubble) {
  transform-origin: left;
}

/* avatar to the right side of the message */

#slime2-event-list[class*='-right'] .message {
  flex-direction: row-reverse;
}

#slime2-event-list[class*='-right'] .background-tail {
  right: -8px;
  border-bottom-left-radius: 10px;
  transform: translateY(0) rotate(-60deg);
  animation: tail-right 4s both infinite;
}

#slime2-event-list[class*='-right'] .background-tail::after {
  right: -10px;
  border-bottom-left-radius: 10px;
}

#slime2-event-list[class*='-right'] :is(.message.exit, .bubble) {
  transform-origin: right;
}

/* avatar to the left side of the message (switched) */

#slime2-event-list[class*='-right']
  :is(
    .switch-subscriber .role-subscriber,
    .switch-vip .role-vip,
    .switch-artist .role-artist,
    .switch-moderator .role-moderator,
    .switch-broadcaster .role-broadcaster
  )
  .message {
  flex-direction: row;
}

#slime2-event-list[class*='-right']
  :is(
    .switch-subscriber .role-subscriber,
    .switch-vip .role-vip,
    .switch-artist .role-artist,
    .switch-moderator .role-moderator,
    .switch-broadcaster .role-broadcaster
  )
  .background-tail {
  right: auto;
  border-bottom-left-radius: 0;
  left: -8px;
  border-bottom-right-radius: 10px;
  transform: translateY(0) rotate(60deg);
  animation: tail-left 4s both infinite;
}

#slime2-event-list[class*='-right']
  :is(
    .switch-subscriber .role-subscriber,
    .switch-vip .role-vip,
    .switch-artist .role-artist,
    .switch-moderator .role-moderator,
    .switch-broadcaster .role-broadcaster
  )
  .background-tail::after {
  right: auto;
  border-bottom-left-radius: 0;
  left: -10px;
  border-bottom-right-radius: 10px;
}

#slime2-event-list[class*='-right']
  :is(
    .switch-subscriber .role-subscriber,
    .switch-vip .role-vip,
    .switch-artist .role-artist,
    .switch-moderator .role-moderator,
    .switch-broadcaster .role-broadcaster
  )
  :is(.message.exit, .bubble) {
  transform-origin: left;
}

/* avatar to the right side of the message (switched) */

#slime2-event-list[class*='-left']
  :is(
    .switch-subscriber .role-subscriber,
    .switch-vip .role-vip,
    .switch-artist .role-artist,
    .switch-moderator .role-moderator,
    .switch-broadcaster .role-broadcaster
  )
  .message {
  flex-direction: row-reverse;
}

#slime2-event-list[class*='-left']
  :is(
    .switch-subscriber .role-subscriber,
    .switch-vip .role-vip,
    .switch-artist .role-artist,
    .switch-moderator .role-moderator,
    .switch-broadcaster .role-broadcaster
  )
  .background-tail {
  left: auto;
  border-bottom-right-radius: 0;
  right: -8px;
  border-bottom-left-radius: 10px;
  transform: translateY(0) rotate(-60deg);
  animation: tail-right 4s both infinite;
}

#slime2-event-list[class*='-left']
  :is(
    .switch-subscriber .role-subscriber,
    .switch-vip .role-vip,
    .switch-artist .role-artist,
    .switch-moderator .role-moderator,
    .switch-broadcaster .role-broadcaster
  )
  .background-tail::after {
  left: auto;
  border-bottom-right-radius: 0;
  right: -10px;
  border-bottom-left-radius: 10px;
}

#slime2-event-list[class*='-left']
  :is(
    .switch-subscriber .role-subscriber,
    .switch-vip .role-vip,
    .switch-artist .role-artist,
    .switch-moderator .role-moderator,
    .switch-broadcaster .role-broadcaster
  )
  :is(.message.exit, .bubble) {
  transform-origin: right;
}

/**********************
 * Username Alignment *
 **********************/

#slime2-event-list[class*='left'] .user {
  align-self: flex-start;
  transform: translateY(0px) rotate(-4deg);
  transform-origin: bottom left;
  animation: nameplate-left 1s both infinite linear;
  margin-left: 7px;
  margin-right: 25px;
}

#slime2-event-list[class*='right'] .user {
  align-self: flex-end;
  transform: translateY(0px) rotate(4deg);
  transform-origin: bottom right;
  animation: nameplate-right 1s both infinite linear;
  margin-right: 7px;
  margin-left: 25px;
}

/* switched */

#slime2-event-list[class*='-right']
  :is(
    .switch-subscriber .role-subscriber,
    .switch-vip .role-vip,
    .switch-artist .role-artist,
    .switch-moderator .role-moderator,
    .switch-broadcaster .role-broadcaster
  )
  .user {
  align-self: flex-start;
  transform: translateY(0px) rotate(-4deg);
  transform-origin: bottom left;
  animation: nameplate-left 1s both infinite linear;
  margin-left: 7px;
  margin-right: 25px;
}

#slime2-event-list[class*='-left']
  :is(
    .switch-subscriber .role-subscriber,
    .switch-vip .role-vip,
    .switch-artist .role-artist,
    .switch-moderator .role-moderator,
    .switch-broadcaster .role-broadcaster
  )
  .user {
  align-self: flex-end;
  transform: translateY(0px) rotate(4deg);
  transform-origin: bottom right;
  animation: nameplate-right 1s both infinite linear;
  margin-right: 7px;
  margin-left: 25px;
}

/********************************
 * Message Type Image Alignment *
 ********************************/

.message-type-image {
  position: absolute;
  display: none;
  top: -40px;
  width: 50px;
  height: 50px;
  animation: item 2.25s both infinite linear;
}

#slime2-event-list[class*='left']
  :is(
    .show-action-image .message-action,
    .show-announcement-image .message-announcement,
    .show-cheer-image .message-cheer,
    .show-highlight-image .message-highlight,
    .show-redeem-image .message-redeem,
    .show-resub-image .message-resub
  )
  .message-type-image {
  right: 0px;
}

#slime2-event-list[class*='right']
  :is(
    .show-action-image .message-action,
    .show-announcement-image .message-announcement,
    .show-cheer-image .message-cheer,
    .show-highlight-image .message-highlight,
    .show-redeem-image .message-redeem,
    .show-resub-image .message-resub
  )
  .message-type-image {
  left: 0px;
}

#slime2-event-list[class*='left']
  :is(
    .show-action-image .message-action,
    .show-announcement-image .message-announcement,
    .show-cheer-image .message-cheer,
    .show-highlight-image .message-highlight,
    .show-redeem-image .message-redeem,
    .show-resub-image .message-resub
  )
  .user {
  margin-right: 50px;
}

#slime2-event-list[class*='right']
  :is(
    .show-action-image .message-action,
    .show-announcement-image .message-announcement,
    .show-cheer-image .message-cheer,
    .show-highlight-image .message-highlight,
    .show-redeem-image .message-redeem,
    .show-resub-image .message-resub
  )
  .user {
  margin-left: 50px;
}

/* switched */

#slime2-event-list[class*='-right']
  :is(
    .switch-subscriber .role-subscriber,
    .switch-vip .role-vip,
    .switch-artist .role-artist,
    .switch-moderator .role-moderator,
    .switch-broadcaster .role-broadcaster
  )
  :is(
    .show-action-image .message-action,
    .show-announcement-image .message-announcement,
    .show-cheer-image .message-cheer,
    .show-highlight-image .message-highlight,
    .show-redeem-image .message-redeem,
    .show-resub-image .message-resub
  )
  .message-type-image {
  left: auto;
  right: 0;
}

#slime2-event-list[class*='-left']
  :is(
    .switch-subscriber .role-subscriber,
    .switch-vip .role-vip,
    .switch-artist .role-artist,
    .switch-moderator .role-moderator,
    .switch-broadcaster .role-broadcaster
  )
  :is(
    .show-action-image .message-action,
    .show-announcement-image .message-announcement,
    .show-cheer-image .message-cheer,
    .show-highlight-image .message-highlight,
    .show-redeem-image .message-redeem,
    .show-resub-image .message-resub
  )
  .message-type-image {
  right: auto;
  left: 0;
}

#slime2-event-list[class*='-right']
  :is(
    .switch-subscriber .role-subscriber,
    .switch-vip .role-vip,
    .switch-artist .role-artist,
    .switch-moderator .role-moderator,
    .switch-broadcaster .role-broadcaster
  )
  :is(
    .show-action-image .message-action,
    .show-announcement-image .message-announcement,
    .show-cheer-image .message-cheer,
    .show-highlight-image .message-highlight,
    .show-redeem-image .message-redeem,
    .show-resub-image .message-resub
  )
  .user {
  margin-left: 7px;
  margin-right: 50px;
}

#slime2-event-list[class*='-left']
  :is(
    .switch-subscriber .role-subscriber,
    .switch-vip .role-vip,
    .switch-artist .role-artist,
    .switch-moderator .role-moderator,
    .switch-broadcaster .role-broadcaster
  )
  :is(
    .show-action-image .message-action,
    .show-announcement-image .message-announcement,
    .show-cheer-image .message-cheer,
    .show-highlight-image .message-highlight,
    .show-redeem-image .message-redeem,
    .show-resub-image .message-resub
  )
  .user {
  margin-right: 7px;
  margin-left: 50px;
}

/**************
 * Animations *
 **************/

@keyframes background-wobble {
  50% {
    border-radius: 25px / 20px;
    border-bottom-left-radius: 30px 25px;
    border-bottom-right-radius: 30px 25px;
    transform: translateY(2px);
  }
}

@keyframes tail-left {
  50% {
    transform: translateY(-6px) rotate(30deg);
  }
}

@keyframes tail-right {
  50% {
    transform: translateY(-6px) rotate(-30deg);
  }
}

@keyframes nameplate-left {
  50% {
    transform: translateY(2px) rotate(-4deg);
  }
}

@keyframes nameplate-right {
  50% {
    transform: translateY(2px) rotate(4deg);
  }
}

@keyframes item {
  50% {
    transform: scale(0.75) rotate(5deg);
  }
}

@keyframes exclamation {
  0% {
    transform: scale(2, 0.2);
  }
  30% {
    transform: scale(0.9, 1.25);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes question {
  0% {
    transform: scale(0.2);
  }

  20% {
    transform: scale(0.2, 1.25);
  }

  60% {
    transform: scale(1.25, 1);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes enter {
  0% {
    transform: scale(0.69);
  }

  69% {
    transform: scale(1.05, 1);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes exit {
  50% {
    transform: scale(0.9);
    opacity: 1;
  }

  100% {
    transform: scale(1.1);
    opacity: 0;
  }
}
