.um-story-composer,
.um-story-builder {
  display: grid;
  gap: 14px;
}

.um-story-builder label {
  display: grid;
  gap: 8px;
  font-weight: 850;
}

.um-story-builder textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid var(--um-line);
  border-radius: var(--um-radius);
  padding: 12px;
  font: inherit;
  background: var(--um-chip-bg, #fff7f8);
}

.um-story-themes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.um-story-theme {
  display: grid;
  gap: 6px;
  justify-items: center;
  border: 1px solid var(--um-line);
  border-radius: var(--um-radius);
  padding: 8px;
  background: var(--um-chip-bg, #fff7f8);
  color: var(--um-text);
  font-weight: 850;
  cursor: pointer;
}

.um-story-theme span {
  width: 100%;
  height: 34px;
  border-radius: 6px;
  background: linear-gradient(160deg, #e11d48, #2563eb);
}

.um-story-theme.is-market span {
  background: linear-gradient(160deg, #9f1239, #2563eb);
}

.um-story-theme.is-night span {
  background: linear-gradient(160deg, #241316, #4c0519);
}

.um-story-theme.is-fresh span {
  background: linear-gradient(160deg, #2563eb, #fb7185);
}

.um-story-theme.is-selected {
  border-color: var(--um-primary);
  box-shadow: 0 0 0 2px rgba(225, 29, 72, 0.16);
}

.um-story-view {
  display: grid;
  align-content: end;
  gap: 8px;
  min-height: 420px;
  border-radius: var(--um-radius);
  padding: 18px;
  color: #fff1f2;
  background: linear-gradient(160deg, #e11d48, #2563eb);
  overflow-wrap: anywhere;
}

.um-story-view.is-market {
  background: linear-gradient(160deg, #9f1239, #2563eb);
}

.um-story-view.is-night {
  background: linear-gradient(160deg, #241316, #4c0519);
}

.um-story-view.is-fresh {
  background: linear-gradient(160deg, #2563eb, #fb7185);
}

.um-story-view strong {
  font-size: 30px;
  line-height: 1.05;
}

.um-story-view span {
  font-weight: 500;
  opacity: 0.82;
}

/* --- Video end screen -----------------------------------------------------------------
   Injected by <unlitube-post-card> over the last frame of a finished video, so it is mounted
   on whatever wrapper holds that <video> rather than on a page-specific container. */
.um-endscreen-host {
  position: relative;
}

.um-endscreen {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 16px;
  overflow-y: auto;
  scrollbar-width: thin;
  background: rgba(10, 8, 9, 0.92);
  color: #fff;
  animation: umEndScreenFade 180ms ease-out;
}

@keyframes umEndScreenFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.um-endscreen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.um-endscreen-replay {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.um-endscreen-replay:hover {
  background: rgba(255, 255, 255, 0.16);
}

.um-endscreen-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.um-endscreen-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.um-endscreen-item:hover .um-endscreen-thumb,
.um-endscreen-item:focus-visible .um-endscreen-thumb {
  outline: 2px solid var(--um-primary);
  outline-offset: 2px;
}

.um-endscreen-thumb {
  display: block;
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: #1b1416;
}

.um-endscreen-thumb img,
.um-endscreen-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.um-endscreen-thumb .um-video-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 0.8rem;
}

.um-endscreen-copy {
  display: block;
  min-width: 0;
}

.um-endscreen-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.85rem;
  line-height: 1.3;
}

.um-endscreen-channel,
.um-endscreen-meta {
  display: block;
  overflow: hidden;
  font-size: 0.75rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  opacity: 0.72;
}

@media (max-width: 900px) {
  .um-endscreen-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .um-endscreen {
    padding: 10px 12px 12px;
  }

  .um-endscreen-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .um-endscreen-item {
    display: grid;
    grid-template-columns: 128px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
  }
}
