.yal-compose-popover {
  position: fixed;
  z-index: 12500;
  width: min(280px, calc(100vw - 24px));
  max-height: 240px;
  overflow: auto;
  border-radius: 14px;
  border: 1px solid #2f3336;
  background: #000;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
  padding: 0.5rem;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.25rem;
}

.yal-compose-popover button {
  border: none;
  background: transparent;
  font-size: 1.35rem;
  line-height: 1.2;
  padding: 0.35rem;
  border-radius: 8px;
  cursor: pointer;
}

.yal-compose-popover button:hover {
  background: rgba(29, 155, 240, 0.15);
}

/* —— X-style compose media upload —— */
.yal-x-compose-media-stack {
  margin-top: 0.75rem;
}

.yal-compose-drop-active {
  outline: 2px dashed #1d9bf0;
  outline-offset: 4px;
  border-radius: 12px;
}

.x-compose-media-preview {
  margin-top: 0;
  position: relative;
  border-radius: 0;
  overflow: visible;
  border: none;
  background: transparent;
}

.x-compose-media-preview.yal-x-enhanced .yal-compose-upload-overlay {
  display: none !important;
}

.yal-x-media-frame {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #2f3336;
  background: #000;
}

.yal-x-media-frame .x-media {
  display: block;
  width: 100%;
  max-height: min(420px, 52vh);
  object-fit: contain;
  background: #000;
  border-radius: 0;
}

.x-compose-media-preview.yal-compose-uploading .yal-x-media-frame .x-media {
  pointer-events: none;
}

.yal-x-media-edit,
.yal-x-media-close {
  position: absolute;
  z-index: 3;
  border: 0;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1;
}

.yal-x-media-edit {
  top: 12px;
  left: 12px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(15, 20, 25, 0.82);
  color: #e7e9ea;
  backdrop-filter: blur(8px);
}

.yal-x-media-edit:hover {
  background: rgba(15, 20, 25, 0.95);
}

.yal-x-media-close {
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(15, 20, 25, 0.82);
  color: #e7e9ea;
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  font-size: 1rem;
}

.yal-x-media-close:hover {
  background: rgba(15, 20, 25, 0.95);
}

.yal-x-caption-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 2px 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #71767b;
  font-size: 0.92rem;
  cursor: pointer;
  text-align: left;
}

.yal-x-caption-row:hover {
  color: #1d9bf0;
}

.yal-x-caption-icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 16px;
  border: 1px solid #536471;
  border-radius: 3px;
  font-size: 0.62rem;
  font-weight: 800;
  color: #e7e9ea;
}

.yal-x-upload-status {
  position: relative;
  margin-top: 12px;
  padding: 16px;
  border-radius: 14px;
  /* Unfilled track: deep blue. The ::before fill paints the bright X-blue
     progress on top so the bar clearly advances as the upload proceeds. */
  background: #0a2a47;
  border: 1px solid rgba(29, 155, 240, 0.5);
  box-shadow: 0 4px 16px rgba(29, 155, 240, 0.22);
  overflow: hidden;
  text-align: center;
}

.yal-x-upload-status::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--yal-x-upload-fill, 0%);
  background: linear-gradient(90deg, #1a8cd8 0%, #1d9bf0 100%);
  transition: width 0.25s ease;
  pointer-events: none;
}

/* Thin determinate progress line pinned to the bottom edge of the bar. */
.yal-x-upload-status::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: var(--yal-x-upload-fill, 0%);
  background: #fff;
  border-radius: 0 3px 3px 0;
  transition: width 0.25s ease;
  pointer-events: none;
}

.yal-x-upload-status-text {
  position: relative;
  z-index: 1;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.yal-x-hidden-remove {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
}

.x-compose-media-preview .x-media {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  background: #000;
}

.yal-compose-status {
  margin-top: 0.35rem;
  color: #71767b;
  font-size: 0.85rem;
}

.yal-compose-status.ok {
  color: #00ba7c;
}

.yal-compose-status.err {
  color: #f4212e;
}
