.moments {
  --bsky-blue: #1185fe;
  --bsky-blue-strong: #0866d9;
  display: flex;
  flex-direction: column;
  gap: var(--gap-p);
}

.moments-source {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
  color: var(--text-p2);
  font-size: 0.9rem;
}

.moments-source > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.moments-source a {
  color: var(--bsky-blue);
  font-weight: 600;
}

.moments-source small {
  color: var(--text-p3);
}

.moment {
  background: var(--card);
  border: 1px solid var(--block-border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 8px 24px rgba(31, 45, 61, 0.06);
  overflow: hidden;
}

.md-text .moment .moment-author {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}

.moment-author-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.moment-author-link img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--block);
}

.moment-author-link > span {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.moment-author-link strong {
  color: var(--text-p1);
}

.moment-author-link small {
  color: var(--text-p3);
  overflow: hidden;
  text-overflow: ellipsis;
}

.moment-source {
  flex: 0 0 auto;
  line-height: 1;
  text-decoration: none;
}

.moment-bsky-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(17, 133, 254, 0.12);
  font-size: 14px;
  line-height: 1;
}

.moment-content {
  color: var(--text-p1);
  font-size: 1rem;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.moment-content a,
.moment-reply-content a {
  color: var(--bsky-blue);
  text-decoration: none;
}

.moment-content a:hover,
.moment-reply-content a:hover {
  text-decoration: underline;
}

.moment-images {
  display: grid;
  gap: 5px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 12px;
}

.moment-images-2,
.moment-images-3,
.moment-images-4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.moment-image-link {
  display: block;
  min-height: 150px;
  background: var(--block);
}

.moment-images-1 .moment-image-link {
  max-height: 520px;
}

.moment-images-3 .moment-image-link:first-child {
  grid-row: span 2;
}

.moment-images img {
  width: 100%;
  height: 100%;
  min-height: 150px;
  max-height: 520px;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.moment-image-link:hover img {
  transform: scale(1.015);
}

.moment-external-media {
  display: block;
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--block-border);
  border-radius: 12px;
  background: var(--block);
  line-height: 0;
}

.moment-external-media img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
}

.moment-external-video {
  display: block;
  width: 100%;
  max-height: 520px;
  margin-top: 14px;
  border-radius: 12px;
  background: #0c1729;
}

.moment-external-card,
.moment-quote {
  display: flex;
  margin-top: 14px;
  border: 1px solid var(--block-border);
  border-radius: 12px;
  overflow: hidden;
  color: var(--text-p1);
  text-decoration: none;
  background: var(--block);
}

.moment-external-card img {
  width: 120px;
  min-height: 96px;
  object-fit: cover;
}

.moment-external-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  padding: 12px;
}

.moment-external-copy span {
  display: -webkit-box;
  color: var(--text-p2);
  font-size: 0.86rem;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.moment-external-copy small {
  color: var(--text-p3);
}

.moment-external-badge {
  display: inline-grid;
  width: 22px;
  height: 22px;
  margin-right: 7px;
  place-items: center;
  border-radius: 50%;
  background: rgba(17, 133, 254, 0.12);
  color: var(--bsky-blue);
  font-size: 0.85rem;
}

.moment-quote {
  flex-direction: column;
  gap: 6px;
  padding: 12px;
}

.moment-quote-author {
  font-weight: 600;
}

.moment-quote-author small {
  color: var(--text-p3);
  font-weight: 400;
}

.moment-video {
  position: relative;
  display: block;
  min-height: 180px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 12px;
  background: #0c1729;
  color: #fff;
}

.moment-video img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  opacity: 0.86;
}

.moment-video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.66);
  transform: translate(-50%, -50%);
}

.moment-video-label {
  position: absolute;
  right: 12px;
  bottom: 10px;
  left: 12px;
  text-align: center;
  text-shadow: 0 1px 4px #000;
}

.moment-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--block-border);
}

.moment-date {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--text-p3);
  font-size: 0.82rem;
  text-decoration: none;
}

.moment-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.moment-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 42px;
  height: 36px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  color: var(--text-p2);
  background: transparent;
  font: inherit;
  font-size: 0.88rem;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.moment-action svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.moment-action:hover,
.moment-action.is-active {
  color: var(--bsky-blue);
  background: rgba(17, 133, 254, 0.1);
}

.moment-action-like:hover {
  color: #e54870;
  background: rgba(229, 72, 112, 0.1);
}

.moment-bsky-reply {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  margin-left: auto;
  padding: 0 14px 0 7px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--bsky-blue), var(--bsky-blue-strong));
  box-shadow: 0 5px 14px rgba(17, 133, 254, 0.22);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.moment-bsky-reply .moment-bsky-mark {
  width: 26px;
  height: 26px;
  background: rgba(255, 255, 255, 0.18);
}

.moment-bsky-reply:hover {
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 7px 18px rgba(17, 133, 254, 0.32);
}

.moment-reply-arrow {
  transition: transform 0.15s ease;
}

.moment-bsky-reply:hover .moment-reply-arrow {
  transform: translateX(2px);
}

.moment-replies {
  margin: 14px -18px -18px;
  padding: 16px 18px 18px;
  border-top: 1px solid var(--block-border);
  background: color-mix(in srgb, var(--block) 58%, transparent);
}

.moment-replies-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.moment-reply {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px;
  margin-left: calc(var(--reply-level) * 18px);
}

.moment-reply-avatar img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--card);
}

.moment-reply-main {
  min-width: 0;
}

.moment-reply-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px;
  line-height: 1.25;
}

.moment-reply-head strong {
  color: var(--text-p1);
  font-size: 0.9rem;
}

.moment-reply-head small,
.moment-reply-head a {
  color: var(--text-p3);
  font-size: 0.78rem;
  text-decoration: none;
}

.moment-reply-head a {
  margin-left: auto;
}

.moment-reply-content {
  margin-top: 4px;
  color: var(--text-p1);
  font-size: 0.9rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.moment-reply .moment-reply {
  margin-top: 14px;
}

.moments-loading,
.moments-error,
.moment-empty,
.moment-replies-loading,
.moment-replies-empty,
.moment-replies-error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 100px;
  padding: 18px;
  border: 1px dashed var(--block-border);
  border-radius: 14px;
  color: var(--text-p2);
  background: var(--card);
  text-align: center;
}

.moments-error {
  flex-direction: column;
}

.moments-error a {
  color: var(--bsky-blue);
}

.moment-replies-loading,
.moment-replies-empty,
.moment-replies-error {
  min-height: 60px;
  background: transparent;
}

.moments-loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(17, 133, 254, 0.22);
  border-top-color: var(--bsky-blue);
  border-radius: 50%;
  animation: moments-spin 0.7s linear infinite;
}

@keyframes moments-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 640px) {
  .moments-source {
    align-items: center;
    flex-direction: row;
    gap: 8px;
    padding: 0 2px;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  .moments-source > span {
    gap: 4px;
    min-width: 0;
  }

  .moments-source .moment-bsky-mark {
    width: 20px;
    height: 20px;
    font-size: 12px;
  }

  .moments-source small {
    flex: 0 0 auto;
  }

  .moment {
    padding: 14px;
    border-radius: 15px;
  }

  .moment-images img,
  .moment-image-link {
    min-height: 120px;
  }

  .moment-external-media img,
  .moment-external-video {
    max-height: 420px;
  }

  .moment-actions {
    gap: 1px;
  }

  .moment-action {
    min-width: 38px;
    padding: 0 7px;
  }

  .moment-bsky-reply {
    padding-right: 11px;
  }

  .moment-reply-arrow {
    display: none;
  }

  .moment-replies {
    margin: 14px -14px -14px;
    padding: 14px;
  }

  .moment-reply {
    margin-left: calc(var(--reply-level) * 8px);
  }
}

@media (max-width: 400px) {
  .moment-bsky-reply > span:nth-child(2) {
    font-size: 0;
  }

  .moment-bsky-reply > span:nth-child(2)::after {
    content: 'Reply';
    font-size: 0.88rem;
  }
}
