.template-card {
  background: #fff;
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 4px 24px rgb(0 0 0 / 8%);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  break-inside: avoid;
  width: 100%;
  box-sizing: border-box;
  transform: translateZ(0);
  will-change: transform;
}

.template-card:active {
  opacity: 0.9;
}

/* 合成对比图片区域 */
.image-comparison {
  position: relative;
  padding: 0;
  flex: 1;
  min-height: 280px;
  border-radius: 16px;
}

.merged-image-container {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  width: 100%;
  height: 100%;
  min-height: 280px;
  display: block;
}

.image-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  min-height: 280px;
}

.overlay-layer {
  transition: clip-path 0.2s ease-out;
  transform: translateZ(0);
  will-change: clip-path;
}

.full-image {
  width: 100%;
  height: 100%;
  min-height: 280px;
  object-fit: cover;
  display: block;
  transform: translateZ(0);
  image-rendering: optimizespeed;
  backface-visibility: hidden;
}

/* 可拖拽分割线 */
.split-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px; /* 增加宽度便于拖拽 */
  background: linear-gradient(to bottom, rgb(255 255 255 / 80%) 0%, rgb(255 255 255 / 90%) 50%, rgb(255 255 255 / 80%) 100%);
  transform: translateX(-50%);
  z-index: 3;
  cursor: col-resize;
  touch-action: none; /* 防止页面滚动 */
  transition: left 0.1s ease-out;
}

.split-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  background: rgb(255 255 255 / 95%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgb(0 0 0 / 25%);
  border: 4px solid rgb(0 122 255 / 40%);
  cursor: col-resize;
  touch-action: none;
  transition: all 0.2s ease;
}

.split-handle:active {
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 8px 32px rgb(0 0 0 / 30%);
}

.split-icon {
  font-size: 24px;
  color: #007aff;
  font-weight: bold;
}

/* ==================== 新布局样式 ==================== */

/* 模板名称悬浮 - 图片底部 */
.name-overlay {
  position: absolute;
  bottom: 16px;
  left: 24px;
  right: 24px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* 水印 */
.watermark {
  position: absolute;
  top: 12px;
  left: 14px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.name-badge {
  background: #0000004d;
  backdrop-filter: blur(5px);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  border-radius: 100px;
  border: 1px solid #ffffff4d;
  width: fit-content;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 8px 12px;
  text-align: center;
}

/* 单视频容器样式 */
.single-video-container {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  width: 100%;
  min-height: 280px;
  display: block;
}

.single-video {
  width: 100%;
  height: 100%;
  min-height: 280px;
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: 16px;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* 自定义视频封面 */
.video-poster {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  object-fit: cover;
  object-position: center;
  border-radius: 16px;
}

/* 视频样式 */
.full-video {
  width: 100%;
  height: 100%;
  min-height: 280px;
  object-fit: cover;
  object-position: center;
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.watermark-text {
  color: rgb(255 255 255 / 50%);
  font-size: 11px;
  font-weight: 400;
  text-align: center;
}
