/* Ech0 说说嵌入 - xscnet 风格 + JS masonry + 媒体增强 */
.md-text > .timeline-ech0-container {
  /* 与顶部主页栏（breadcrumb）左右对齐：article 内边距 16px，breadcrumb 用 -4px 负边距扩展到 696px，这里同手法。
     选择器加 .md-text > 前缀提升优先级，覆盖 stellar 的 .md-text > div { margin: var(--gap-p) 0; } */
  margin: 21px -4px;
  padding: 8px 0;
  position: relative;
}

/* 加载/错误/空状态 */
.timeline-ech0-container.timeline-loading,
.timeline-ech0-container.timeline-empty,
.timeline-ech0-container.timeline-error {
  text-align: center;
  padding: 50px 20px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 24px;
  color: var(--text-meta, #666);
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.timeline-ech0-container.timeline-error { color: #e53935; }
.timeline-ech0-container.timeline-error small {
  color: var(--text-meta, #999);
  font-size: 12px;
}

/* 毛玻璃卡片（position 由 JS masonry 设置）- 渐变背景 */
.timeline-ech0-container .timeline-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.10) 0%, rgba(168, 85, 247, 0.06) 50%, rgba(236, 72, 153, 0.08) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 24px;
  padding: 20px 24px;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
}
.timeline-ech0-container .timeline-card:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.14) 0%, rgba(168, 85, 247, 0.10) 50%, rgba(236, 72, 153, 0.12) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.30);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

[data-theme="dark"] .timeline-ech0-container .timeline-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18) 0%, rgba(168, 85, 247, 0.12) 50%, rgba(236, 72, 153, 0.15) 100%);
  border: 1px solid rgba(255, 255, 255, 0.10);
}
[data-theme="dark"] .timeline-ech0-container .timeline-card:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.24) 0%, rgba(168, 85, 247, 0.18) 50%, rgba(236, 72, 153, 0.20) 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

/* 卡片头部：头像 + 昵称 + 时间（左对齐，单行横排） */
.timeline-ech0-container .timeline-card-meta {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.timeline-ech0-container .timeline-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.7);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.timeline-ech0-container .timeline-meta-info {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  flex: 1;
  flex-wrap: wrap;
}
.timeline-ech0-container .timeline-nick {
  font-weight: 600;
  font-size: 15px;
  color: #4a90e2;
  line-height: 1.3;
}
.timeline-ech0-container .timeline-time {
  color: #888;
  font-size: 12px;
  line-height: 1.3;
}
.timeline-ech0-container .timeline-time::before {
  content: '·';
  margin-right: 8px;
  color: #aaa;
  font-weight: bold;
}
[data-theme="dark"] .timeline-ech0-container .timeline-card-meta {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .timeline-ech0-container .timeline-avatar {
  border-color: rgba(255, 255, 255, 0.3);
}
[data-theme="dark"] .timeline-ech0-container .timeline-nick { color: #6bb5ff; }
[data-theme="dark"] .timeline-ech0-container .timeline-time { color: rgba(255, 255, 255, 0.55); }
[data-theme="dark"] .timeline-ech0-container .timeline-time::before { color: rgba(255, 255, 255, 0.4); }

/* 卡片正文 */
.timeline-ech0-container .timeline-card-body {
  line-height: 1.7;
  font-size: 0.95rem;
  color: #333;
}
.timeline-ech0-container .timeline-text-content {
  word-wrap: break-word;
  white-space: pre-wrap;
  color: #333;
}
.timeline-ech0-container .timeline-text-content code {
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 6px;
  font-family: 'Consolas', monospace;
  font-size: 0.85em;
  color: #e83e8c;
}
[data-theme="dark"] .timeline-ech0-container .timeline-card-body,
[data-theme="dark"] .timeline-ech0-container .timeline-text-content {
  color: rgba(255, 255, 255, 0.85);
}
[data-theme="dark"] .timeline-ech0-container .timeline-text-content code {
  background: rgba(255, 255, 255, 0.1);
  color: #ff6b9d;
}

/* 图片 */
.timeline-ech0-container .timeline-images {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.timeline-ech0-container .timeline-image-link {
  display: block;
  cursor: zoom-in;
  border-radius: 14px;
  overflow: hidden;
}
.timeline-ech0-container .timeline-images img {
  max-width: 100%;
  max-height: 320px;
  border-radius: 14px;
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
}
.timeline-ech0-container .timeline-images img:hover { transform: scale(1.03); }

/* 音乐播放器 */
.timeline-ech0-container .timeline-music {
  margin-top: 14px;
  border-radius: 14px;
  overflow: hidden;
}
.timeline-ech0-container .timeline-music .aplayer {
  border-radius: 14px;
  box-shadow: none;
}

/* Bilibili 视频（16:9） */
.timeline-ech0-container .timeline-video {
  margin-top: 14px;
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 14px;
}
.timeline-ech0-container .timeline-video iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* 媒体（位置等简化版） */
.timeline-ech0-container .timeline-media {
  margin-top: 14px;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 14px;
  font-size: 14px;
  color: #666;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.timeline-ech0-container .timeline-media .media-label { font-size: 16px; }
.timeline-ech0-container .timeline-media a {
  color: #4a90e2;
  text-decoration: none;
}
.timeline-ech0-container .timeline-media a:hover { text-decoration: underline; }
[data-theme="dark"] .timeline-ech0-container .timeline-media {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.7);
}
[data-theme="dark"] .timeline-ech0-container .timeline-media a { color: #6bb5ff; }

/* 灯箱 */
.timeline-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  cursor: zoom-out;
  animation: timeline-lightbox-fade 0.2s ease;
}
.timeline-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}
@keyframes timeline-lightbox-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 卡片底部操作栏：左侧位置标签 + 右侧点赞/评论/分享 */
.timeline-ech0-container .timeline-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  position: relative; /* 分享 popover 定位锚点 */
}
.timeline-ech0-container .action-location {
  font-size: 12px;
  color: #888;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50%;
}
.timeline-ech0-container .action-buttons {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  margin-left: auto;
}
.timeline-ech0-container .action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #888;
  font-size: 12px;
  line-height: 1;
  transition: all 0.2s ease;
  font-family: inherit;
}
.timeline-ech0-container .action-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #555;
}
.timeline-ech0-container .action-btn.is-animating {
  animation: ech0-like-pop 0.3s ease;
}
@keyframes ech0-like-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.25); }
  100% { transform: scale(1); }
}
.timeline-ech0-container .action-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.timeline-ech0-container .action-count {
  min-width: 12px;
  text-align: left;
  font-variant-numeric: tabular-nums;
}
/* 点赞已激活：红色 */
.timeline-ech0-container .action-like.is-liked {
  color: #e53935;
}
.timeline-ech0-container .action-like.is-liked:hover {
  background: rgba(229, 57, 53, 0.08);
  color: #c62828;
}
[data-theme="dark"] .timeline-ech0-container .timeline-card-actions {
  border-top-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .timeline-ech0-container .action-location {
  color: rgba(255, 255, 255, 0.5);
}
[data-theme="dark"] .timeline-ech0-container .action-btn {
  color: rgba(255, 255, 255, 0.55);
}
[data-theme="dark"] .timeline-ech0-container .action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
}
[data-theme="dark"] .timeline-ech0-container .action-like.is-liked {
  color: #ff6b6b;
}
[data-theme="dark"] .timeline-ech0-container .action-like.is-liked:hover {
  background: rgba(255, 107, 107, 0.12);
  color: #ff5252;
}

/* 分享 popover 打开时，提升当前卡片 z-index，避免被下方 absolute 卡片遮挡 */
.timeline-ech0-container .timeline-card.is-share-open {
  z-index: 50;
}

/* 分享锚点高亮（从 #talk-{id} 跳转来时） */
.timeline-ech0-container .timeline-card.is-highlighted {
  animation: ech0-card-highlight 2s ease;
}
@keyframes ech0-card-highlight {
  0%, 100% { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); }
  20%, 60% { box-shadow: 0 4px 30px rgba(99, 102, 241, 0.45); }
}

/* Toast 提示（点赞模块用） */
.ech0-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.ech0-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 响应式 */
@media (max-width: 768px) {
  .timeline-ech0-container .timeline-card { padding: 15px 18px; }
}
