.um-composer,
.um-card,
.um-module,
.um-panel-pop {
  background: var(--um-surface-strong);
  border: 1px solid var(--um-line);
  border-radius: var(--um-radius);
  box-shadow: 0 8px 22px rgba(32, 35, 31, 0.05);
}

.um-composer {
  padding: 14px;
}

.um-composer-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.um-composer input[name="message"] {
  height: 46px;
  min-width: 0;
  flex: 1;
  border: 1px solid var(--um-line);
  border-radius: 999px;
  padding: 13px 16px;
  font: inherit;
  background: var(--um-chip-bg, #fff7f8);
}

.um-composer-tools {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  border-top: 1px solid var(--um-line);
  padding-top: 12px;
  align-items: flex-start;
}

.um-composer-tools > div {
  flex: 1;
  min-width: 0;
}

.um-composer-upload-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.um-composer-upload-progress-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--um-line);
  overflow: hidden;
}

.um-composer-upload-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--um-primary);
  transition: width 0.2s ease;
}

.um-composer-upload-progress-label {
  font-size: 13px;
  color: var(--um-muted);
  white-space: nowrap;
}

.um-file-tool {
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.um-file-tool input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.um-composer-drop-overlay {
  position: absolute;
  inset: -8px;
  display: none;
  place-items: center;
  border: 2px dashed var(--um-primary);
  border-radius: var(--um-radius);
  background: rgba(225, 29, 72, 0.08);
  /* The overlay must not swallow the pointer, or crossing it fires dragleave and cancels the drop. */
  pointer-events: none;
  z-index: 2;
}

.um-composer-drop-overlay span {
  padding: 8px 14px;
  border-radius: var(--um-radius);
  background: var(--um-surface-strong);
  color: var(--um-text);
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.um-composer-preview {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid var(--um-line);
  border-radius: var(--um-radius);
  background: var(--um-chip-bg-strong, #fff1f2);
}

.um-composer-preview img,
.um-composer-preview video {
  width: 112px;
  height: 74px;
  object-fit: cover;
  border-radius: calc(var(--um-radius) - 2px);
  background: #111;
}

.um-composer-preview div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.um-composer-preview strong,
.um-composer-preview span {
  overflow-wrap: anywhere;
}

.um-link-preview {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid var(--um-line);
  border-radius: var(--um-radius);
  background: var(--um-chip-bg-strong, #fff1f2);
}

.um-link-preview.is-loading {
  display: block;
  color: var(--um-muted);
  font-size: 13px;
}

.um-link-preview-media {
  position: relative;
  width: 96px;
  height: 64px;
  border-radius: calc(var(--um-radius) - 2px);
  overflow: hidden;
  background: #111;
}

.um-link-preview-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.um-link-preview-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 20px;
  background: rgba(0, 0, 0, 0.25);
}

.um-link-preview-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.um-link-preview-body strong,
.um-link-preview-body small {
  overflow-wrap: anywhere;
}

.um-link-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 520px;
}

.um-link-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.um-link-embed-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 520px;
  border: 0;
  padding: 0;
  margin: 0;
  display: block;
  background: #111;
  cursor: pointer;
}

.um-link-embed-preview img,
.um-link-embed-preview .um-media-image-shell {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.um-link-embed-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 42px;
  background: rgba(0, 0, 0, 0.25);
}

/* Two classes on purpose. The card also carries .um-media, and media-core.css - which loads
   AFTER this file (see includes/style-parts.php) - styles .um-media as a black, 520px-capped
   block. With a single-class selector that rule won the tie on source order, so every link
   card rendered as display:block on #111 with dark text on it: unreadable. Same cascade trap
   as the media viewer (media-viewer-cascade.test.js). */
.um-media.um-link-card {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  max-height: none;
  text-decoration: none;
  color: var(--um-text);
  border: 1px solid var(--um-line);
  border-radius: var(--um-radius);
  background: var(--um-surface-strong);
  overflow: hidden;
}

/* --- TikTok share card -------------------------------------------------------
   Fixed ratio: the caption on white across the left two-thirds, the video's preview in a
   portrait (9:16) column on the right third. A 9:16 column one-third wide makes the whole
   card 27:16, so it keeps exactly this shape at every width. */
.um-media.um-link-card.um-link-card-tiktok {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 0;
  aspect-ratio: 27 / 16;
  background: #fff;
  color: #1c1e21;
}

/* Three classes: the generic ".um-link-card > .um-media-image-shell { width: 120px }" rule
   further down has two, and at equal specificity it won on source order - the preview
   rendered 120px wide instead of filling its third (measured live: 120 vs 225px). */
.um-link-card.um-link-card-tiktok > .um-media-image-shell {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  border-left: 1px solid var(--um-line);
}

.um-link-card-tiktok > .um-link-card-body {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding: 18px 20px;
  overflow: hidden;
}

.um-link-card-tiktok .um-link-card-site {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
  color: #1c1e21;
}

.um-link-card-tiktok .um-link-card-handle {
  font-weight: 600;
  color: #65676b;
}

.um-link-card-tiktok .um-link-card-body strong {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 9;
  overflow: hidden;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.45;
  color: #1c1e21;
}

.um-link-card-tiktok .um-link-card-cta {
  margin-top: auto;
  align-self: flex-start;
  padding: 8px 14px;
  border-radius: 999px;
  background: #fe2c55;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.um-link-card-tiktok:hover .um-link-card-cta,
.um-link-card-tiktok:focus-visible .um-link-card-cta {
  background: #e0244a;
}

.um-link-card-tiktok:focus-visible {
  outline: 3px solid #fe2c55;
  outline-offset: 2px;
}

/* TikTok's thumbnail URLs are signed and expire, and it refuses to describe some videos at all
   (its oEmbed answers 400) - so there is not always a picture to show. The preview column is
   then a deliberate dark panel with a play mark, not an empty box. */
.um-link-card-tiktok .um-media-image-shell.is-image-failed .um-media-image-fallback {
  align-content: center;
  gap: 10px;
  background: linear-gradient(160deg, #111 0%, #25131a 55%, #0f2a2e 100%);
  font-size: 13px;
}

.um-link-card-tiktok .um-media-image-fallback::before {
  content: "\25B6";
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 auto;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 18px;
}

@media (max-width: 640px) {
  .um-link-card-tiktok > .um-link-card-body {
    gap: 6px;
    padding: 12px;
  }

  .um-link-card-tiktok .um-link-card-body strong {
    -webkit-line-clamp: 4;
    font-size: 14px;
  }

  .um-link-card-tiktok .um-link-card-cta {
    padding: 6px 10px;
    font-size: 12px;
  }
}

.um-link-card > img,
.um-link-card > .um-media-image-shell {
  width: 120px;
  height: 100%;
  min-height: 90px;
  object-fit: cover;
  background: #111;
}

.um-link-card-body {
  display: grid;
  gap: 4px;
  align-content: center;
  padding: 10px 12px 10px 0;
  min-width: 0;
}

.um-link-card-body strong,
.um-link-card-body small {
  overflow-wrap: anywhere;
}

.um-link-card-body p {
  margin: 0;
  color: var(--um-muted);
  font-size: 13px;
}

.um-ad {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
}

.um-ad-art {
  height: 74px;
  border-radius: var(--um-radius);
  background: linear-gradient(135deg, #e11d48, #2563eb);
}

.um-link-button {
  border: 0;
  background: transparent;
  color: var(--um-teal);
  padding: 4px 0;
  text-align: left;
  font-weight: 800;
  cursor: pointer;
}

.um-field {
  width: 100%;
  border: 1px solid var(--um-line);
  border-radius: var(--um-radius);
  padding: 12px;
  background: var(--um-chip-bg-strong, #fff1f2);
  color: var(--um-text);
  font: inherit;
}

.um-field:focus {
  outline: none;
  border-color: var(--um-primary);
}

.um-composer-writing-surface textarea {
  width: 100%;
  min-height: 52px;
  max-height: 230px;
  resize: none;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  padding: 0;
  font: inherit;
  font-size: 22px;
  line-height: 1.25;
  background: transparent;
  color: inherit;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.um-composer-writing-surface {
  min-height: 96px;
  display: flex;
  align-items: flex-start;
  padding: 12px 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--um-text);
}

.um-composer-writing-surface.has-background {
  min-height: 250px;
  align-items: center;
  justify-content: center;
  padding: 24px;
  border-radius: 0;
}

.um-composer-writing-surface.has-background textarea {
  min-height: 74px;
  max-height: 190px;
  text-align: center;
  line-height: 1.15;
  font-weight: 900;
  color: #fff;
}

.um-composer-writing-surface.has-background.is-text-xl textarea {
  font-size: 40px;
}

.um-composer-writing-surface.has-background.is-text-lg textarea {
  font-size: 34px;
}

.um-composer-writing-surface.has-background.is-text-md textarea {
  font-size: 27px;
}

.um-composer-writing-surface.has-background.is-text-sm textarea {
  font-size: 21px;
}

.um-composer-writing-surface.has-background textarea::placeholder {
  color: rgba(255, 255, 255, 0.82);
}

.um-composer-background-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  padding: 2px 0;
}

.um-background-swatch,
.um-background-nav,
.um-background-grid {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: #e5e7eb;
  color: #111827;
  font-weight: 900;
  cursor: pointer;
}

.um-background-swatch {
  border-radius: 10px;
}

.um-background-swatch.is-selected {
  outline: 3px solid #ffffff;
  box-shadow: 0 0 0 5px rgba(225, 29, 72, 0.9);
}

.um-background-nav:hover,
.um-background-grid:hover,
.um-background-swatch:hover {
  filter: brightness(0.96);
}
