#compose-container {
  width: 40em;
  max-width: 100vw;
  align-self: stretch;
  animation: fade-in 0.2s ease-out;
  max-height: 100vh;
  overflow: auto;
}
#compose-container.standalone {
  max-height: none;
  margin: auto;
}

#compose-container .compose-top {
  text-align: right;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

#compose-container textarea {
  width: 100%;
  max-width: 100%;
  height: 4em;
  min-height: 4em;
  max-height: 10em;
  resize: vertical;
  line-height: 1.4;
}

@media (min-width: 40em) {
  #compose-container textarea {
    font-size: 150%;
    font-size: calc(100% + 50% / var(--text-weight));
  }
}

@keyframes appear-up {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}
#compose-container .status-preview {
  border-radius: 8px 8px 0 0;
  max-height: 160px;
  background-color: var(--bg-color);
  margin: 0 12px;
  border: 1px solid var(--outline-color);
  border-bottom: 0;
  animation: appear-up 1s ease-in-out;
  overflow: auto;
}
#compose-container.standalone .status-preview * {
  /*
    For standalone mode (new window), prevent interacting with the status preview for now
  */
  pointer-events: none;
}

#compose-container .status-preview-legend {
  pointer-events: none;
  position: sticky;
  bottom: 0;
  padding: 8px;
  font-size: 80%;
  font-weight: bold;
  text-align: center;
  color: var(--text-insignificant-color);
  background-color: var(--bg-blur-color);
  /* background-image: linear-gradient(
    to bottom,
    transparent,
    var(--bg-faded-color)
  ); */
  border-top: 1px solid var(--outline-color);
  backdrop-filter: blur(8px);
  text-shadow: 0 1px 10px var(--bg-color), 0 1px 10px var(--bg-color),
    0 1px 10px var(--bg-color), 0 1px 10px var(--bg-color),
    0 1px 10px var(--bg-color);
  z-index: 2;
}
#_compose-container .status-preview-legend.reply-to {
  color: var(--reply-to-color);
  background-color: var(--reply-to-faded-color);
  /* background-image: linear-gradient(
    to bottom,
    transparent,
    var(--reply-to-faded-color)
  ); */
}

#compose-container form {
  border-radius: 8px;
  padding: 4px 12px;
  background-image: linear-gradient(var(--bg-color) 75%, transparent);
  position: relative;
  z-index: 1;
}
#compose-container .status-preview ~ form {
  box-shadow: 0 -12px 12px -12px var(--divider-color);
}

#compose-container .toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  gap: 8px;
}
#compose-container .toolbar.stretch {
  justify-content: stretch;
}
#compose-container .toolbar .spoiler-text-field {
  flex: 1;
  min-width: 0;
}
#compose-container .toolbar-button {
  display: inline-block;
  color: var(--text-color);
  background-color: var(--bg-faded-color);
  padding: 0 8px;
  border-radius: 8px;
  min-height: 2.4em;
  line-height: 2.4em;
  min-width: 2.6em;
  text-align: center;
  overflow: hidden;
  position: relative;
  white-space: nowrap;
  border: 2px solid transparent;
  vertical-align: middle;
}
#compose-container .toolbar-button > * {
  vertical-align: middle;
  cursor: inherit;
  outline: 0;
}
#compose-container .toolbar-button:has([disabled]) {
  pointer-events: none;
  background-color: var(--bg-faded-color);
  opacity: 0.5;
}
#compose-container
  .toolbar-button:not(.show-field)
  :is(input[type='checkbox'], select, input[type='file']) {
  opacity: 0;
  position: absolute;
  left: 0;
  height: 100%;
  margin: 0;
}
#compose-container .toolbar-button input[type='file'] {
  /* Move this out of the way, to fix cursor: pointer bug */
  left: -100vw !important;
}
#compose-container .toolbar-button select {
  background-color: transparent;
  border: 0;
  padding: 0 0 0 8px;
}
#compose-container .toolbar-button:not(.show-field) select {
  right: 0;
  left: auto !important;
}
#compose-container
  .toolbar-button:not(:disabled):is(
    :hover,
    :focus,
    :focus-within,
    :focus-visible
  ) {
  cursor: pointer;
  filter: none;
  border-color: var(--divider-color);
  outline: 0;
}
#compose-container .toolbar-button:not(:disabled):active {
  filter: brightness(0.8);
}

#compose-container .toolbar-button .icon-text {
  display: inline-block;
  font-size: 14px;
  font-weight: 500;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 100%;
}

#compose-container text-expander {
  position: relative;
}
#compose-container .text-expander-menu {
  color: var(--text-color);
  background-color: var(--bg-color);
  position: absolute;
  margin: 0 0 0 -8px;
  padding: 0;
  list-style: none;
  border: 1px solid var(--outline-color);
  /* box-shadow: 0 0 12px var(--outline-color); */
  border-radius: 8px;
  overflow: hidden;
  top: 0 !important;
  z-index: 100;
  min-width: 50vw;
}
#compose-container .text-expander-menu li {
  white-space: nowrap;
  padding: 8px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 90%;
}
#compose-container .text-expander-menu li b img {
  /* The shortcode emojis */
  width: 0.9em;
  height: 0.9em;
}
#compose-container .text-expander-menu li .avatar {
  width: 2.2em;
  height: 2.2em;
}
#compose-container .text-expander-menu li:is(:hover, :focus) {
  color: var(--bg-color);
  background-color: var(--link-color);
}

#compose-container .media-attachments {
  background-color: var(--bg-faded-color);
  padding: 8px;
  border-radius: 8px;
  margin: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#compose-container .media-attachment {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
#compose-container .media-preview {
  flex-shrink: 1;
}
#compose-container .media-preview > * {
  min-width: 80px;
  width: 80px !important;
  height: 80px;
  object-fit: contain;
  background-color: var(--img-bg-color);
  border-radius: 8px;
  border: 1px solid var(--outline-color);
}
#compose-container .media-attachment textarea {
  height: 80px;
  flex-grow: 1;
  resize: none;
}
#compose-container .media-attachments .media-desc {
  flex-grow: 1;
}
#compose-container .media-attachments .media-desc p {
  font-size: 90%;
  margin: 0;
  padding: 0;
  /* clamp 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
#compose-container .media-attachments .media-desc p i {
  color: var(--text-insignificant-color);
}
#compose-container .media-aside {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
}
#compose-container .media-aside .close-button {
  padding: 4px;
  align-self: flex-start;
  color: var(--text-insignificant-color);
}
#compose-container .media-aside .close-button:is(:hover, :focus) {
  color: var(--text-color);
}
#compose-container .media-aside .uploaded {
  color: var(--green-color);
  margin-bottom: 4px;
}

#compose-container form .poll {
  background-color: var(--bg-faded-color);
  border-radius: 8px;
  margin: 8px 0 0;
}

#compose-container .poll-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
}
#compose-container .poll-choice {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: stretch;
  flex-direction: row-reverse;
}
#compose-container .poll-choice input {
  flex-grow: 1;
  min-width: 0;
}

#compose-container .poll-button {
  border: 2px solid var(--outline-color);
  width: 28px;
  height: 28px;
  padding: 0;
  flex-shrink: 0;
  line-height: 0;
  overflow: hidden;
  transition: border-radius 1s ease-out;
  font-size: 14px;
}
#compose-container .multiple .poll-button {
  border-radius: 4px;
}

#compose-container .poll-toolbar {
  display: flex;
  gap: 8px;
  align-items: stretch;
  justify-content: space-between;
  font-size: 90%;
  border-top: 1px solid var(--outline-color);
  padding: 8px;
}
#compose-container .poll-toolbar select {
  padding: 4px;
}

#compose-container .multiple-choices {
  flex-grow: 1;
  display: flex;
  gap: 4px;
  align-items: center;
  border-left: 1px solid var(--outline-color);
  padding-left: 8px;
}

#compose-container .expires-in {
  flex-grow: 1;
  border-left: 1px solid var(--outline-color);
  padding-left: 8px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

#compose-container .remove-poll-button {
  width: 100%;
  color: var(--red-color);
}

@media (display-mode: standalone) {
  /* No popping in standalone mode */
  #compose-container .pop-button {
    display: none;
  }
}
