@layer pages {
.bbcode-toolbar-emojis {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

.bbcode-emoji-editor-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
  isolation: isolate;
}

.bbcode-emoji-editor-wrap > textarea {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
}

.bbcode-emoji-editor-render {
  position: absolute;
  inset: 0;
  z-index: 1;
  box-sizing: border-box;
  overflow: hidden;
  background: transparent;
  border-color: transparent;
  color: var(--text-light);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  visibility: hidden;
  pointer-events: none;
}

.bbcode-emoji-editor-wrap.is-emoji-mirror-active > .bbcode-emoji-editor-render {
  visibility: visible;
}

.bbcode-emoji-editor-wrap.is-emoji-mirror-active > textarea {
  background: transparent;
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: transparent;
}

.bbcode-emoji-editor-wrap.is-emoji-mirror-active > textarea::selection {
  background: transparent;
  -webkit-text-fill-color: transparent;
}

.bbcode-emoji-editor-render .mt-emoji:not(.custom-emoji--reaction):not(.custom-emoji--picker),
.bbcode-emoji-editor-render .custom-emoji--inline {
  box-sizing: content-box;
  display: inline-block;
  width: var(--emoji-scale);
  height: var(--emoji-scale);
  max-width: none;
  max-height: none;
  margin: 0 0.05em;
  vertical-align: -0.25em;
  object-fit: contain;
  line-height: 1;
}

.bbcode-emoji-editor-render.mt-emoji-only img.mt-emoji:not(.custom-emoji--reaction):not(.custom-emoji--picker):not(.forum-reaction-emoji),
.bbcode-emoji-editor-render.mt-emoji-only img.custom-emoji--inline {
  width: var(--emoji-scale);
  height: var(--emoji-scale);
  min-width: var(--emoji-scale);
  min-height: var(--emoji-scale);
  vertical-align: -0.25em;
}

.bbcode-emoji-editor-caret {
  position: absolute;
}

@media (max-width: 480px) {
  .bbcode-toolbar {
    gap: 0.2rem;
    padding: 0.4rem;
  }

  .bbcode-toolbar button {
    min-width: 32px;
    height: 32px;
    padding-inline: 0.3rem;
  }

  .bbcode-toolbar-emojis {
    gap: 0.2rem;
  }
}
}
