[v-cloak] { display: none; }

/* 防止Vue初始化前显示模板语法 */
.digital-human-app.vue-loading {
  visibility: hidden;
}

.digital-human-app.vue-ready {
  visibility: visible;
}

body.digital-human-page {
  background: #f5f7fa;
  padding: 0 !important;
  padding-top: 64px !important;
}

.digital-human-app {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 340px;
  height: calc(100vh - 64px);
  gap: 20px;
  padding: 16px 20px;
  box-sizing: border-box;
}

.digital-human-app .dh-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dh-card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

.dh-card.compact {
  gap: 12px;
  padding: 16px;
}

.dh-card + .dh-card {
  margin-top: 16px;
}

.dh-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.dh-card-header h2,
.dh-card-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #0f172a;
}

.dh-card-header .dh-caption {
  margin: 4px 0 0;
  font-size: 12px;
  color: #64748b;
}

.dh-card-header .dh-selected-meta {
  font-size: 12px;
  color: #475569;
  text-align: right;
}

.dh-preview-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dh-action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.dh-action-label {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
}

.dh-square-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 16px;
}

.dh-square-btn:hover:not(:disabled) {
  background: #f8fafc;
  color: #475569;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.dh-square-btn:disabled {
  background: #f8fafc;
  color: #cbd5e1;
  border-color: #f1f5f9;
  cursor: not-allowed;
  transform: none;
}

.dh-icon-button {
  border: none;
  background: #eff6ff;
  color: #1d4ed8;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dh-icon-button:hover {
  background: #dbeafe;
}

.dh-icon-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* AI润色按钮特殊样式 */
.dh-icon-button.polish-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  transition: all 0.3s ease;
}

.dh-icon-button.polish-btn:hover {
  background: linear-gradient(135deg, #5568d3 0%, #6a3f91 100%);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.dh-icon-button.polish-btn i {
  animation: sparkle 2s infinite;
}

@keyframes sparkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.dh-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.dh-filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: #64748b;
}

.dh-filter select {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: #0f172a;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dh-filter select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  outline: none;
}

.dh-search {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 14px;
  color: #64748b;
}

.dh-search input {
  border: none;
  outline: none;
  flex: 1;
  font-size: 13px;
  color: #0f172a;
}

.dh-search input::placeholder {
  color: #94a3b8;
}

.dh-template-scroll {
  flex: 1;
  overflow-y: auto;
  padding-right: 6px;
}

.dh-template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.dh-template-card {
  border: 1px solid transparent;
  border-radius: 14px;
  background: #f8fafc;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.dh-template-card:hover {
  border-color: #bfdbfe;
  background: #eef2ff;
  transform: translateY(-2px);
}

.dh-template-card.selected {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  background: #e0ecff;
}

.dh-template-thumb {
  position: relative;
  width: 72px;
  height: 96px;
  border-radius: 10px;
  background: #e2e8f0;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dh-template-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dh-template-thumb-fallback {
  color: #94a3b8;
  font-size: 26px;
}

.dh-style-count {
  position: absolute;
  right: 4px;
  bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 2px 4px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.85);
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  z-index: 2;
  pointer-events: none;
  line-height: 1;
}

.dh-play-overlay {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.dh-template-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  align-items: center;
}

.dh-template-meta h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.dh-template-meta p {
  margin: 0;
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

.dh-template-meta .dh-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dh-tag {
  background: #e2e8f0;
  color: #0f172a;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
}

.dh-empty {
  padding: 40px 12px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
}

.dh-load-more {
  margin-top: 12px;
  width: 100%;
  border: 1px solid #cbd5f5;
  background: #fff;
  border-radius: 10px;
  font-size: 13px;
  padding: 10px 0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dh-load-more:hover {
  background: #eff6ff;
}

.dh-load-more:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.dh-skeleton-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.dh-skeleton-card {
  border-radius: 12px;
  background: linear-gradient(120deg, #f1f5f9 0%, #e2e8f0 45%, #f1f5f9 100%);
  background-size: 200% 100%;
  animation: dh-skeleton 1.5s infinite;
  height: 110px;
}

@keyframes dh-skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.preview-card {
  flex: 1;
}

.dh-preview-body {
  flex: 1;
  background: transparent;
  border-radius: 0;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  min-height: 600px;
  position: relative;
  overflow: hidden;
}

.dh-preview-media {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dh-preview-video,
.dh-preview-image {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 700px;
  border-radius: 0;
  border: none;
  object-fit: contain;
  background: transparent;
}

.dh-preview-video {
  cursor: pointer;
}

.dh-preview-media video::-webkit-media-controls {
  display: none !important;
}

.dh-preview-video-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.55);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.dh-preview-video-overlay i {
  font-size: 24px;
}

.dh-preview-media.playing .dh-preview-video-overlay {
  opacity: 0;
}

.dh-preview-placeholder {
  text-align: center;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  justify-content: center;
}

.dh-preview-placeholder i {
  font-size: 42px;
  color: #cbd5f5;
}

.dh-loading-state {
  text-align: center;
  color: #1e293b;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.dh-spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 5px solid #dbeafe;
  border-top-color: #2563eb;
  animation: dh-spin 1s linear infinite;
}

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

.dh-error-state {
  color: #dc2626;
  font-size: 13px;
  text-align: center;
}

.dh-history {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.dh-history-card {
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  font-size: 12px;
  color: #475569;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dh-history-card strong {
  font-size: 13px;
  color: #0f172a;
}

.dh-history-card button {
  border: none;
  background: none;
  color: #2563eb;
  cursor: pointer;
}

.dh-card textarea {
  width: 100%;
  min-height: 280px;
  resize: vertical;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
  color: #0f172a;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dh-card textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  outline: none;
}

.dh-char-count {
  text-align: right;
  font-size: 12px;
  color: #64748b;
}

/* 样式列表样式 */
.dh-styles-container {
  padding: 8px 0;
}

.dh-styles-loading,
.dh-styles-error,
.dh-styles-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
  color: #64748b;
  font-size: 14px;
  gap: 8px;
}

.dh-styles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 12px;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px;
}

.dh-style-item {
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.dh-style-item:hover {
  border-color: #bfdbfe;
  background: #eef2ff;
  transform: translateY(-1px);
}

.dh-style-item.selected {
  border-color: #2563eb;
  background: #e0ecff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.dh-style-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 6px;
  background: #e2e8f0;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dh-style-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dh-style-thumb-fallback {
  color: #94a3b8;
  font-size: 20px;
}

.dh-style-badge {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 16px;
  height: 16px;
  background: rgba(15, 23, 42, 0.8);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
}

.dh-style-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  align-items: center;
}

.dh-style-name {
  font-size: 12px;
  font-weight: 500;
  color: #1e293b;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  text-align: center;
}

.dh-style-duration {
  font-size: 10px;
  color: #64748b;
  font-weight: 400;
}

.dh-default-style {
  color: #2563eb !important;
  font-weight: 600 !important;
}

/* 数字人生成全屏动画 */
.dh-fullscreen-loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 50%, #1e293b 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  overflow: hidden;
}

.dh-fullscreen-loading::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 30% 40%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
              radial-gradient(circle at 80% 20%, rgba(168, 85, 247, 0.15) 0%, transparent 50%),
              radial-gradient(circle at 40% 80%, rgba(34, 197, 94, 0.1) 0%, transparent 50%);
  animation: dh-bg-pulse 4s ease-in-out infinite;
}

.dh-ai-avatar {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 40px;
  z-index: 1;
}

.dh-avatar-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(45deg, #3b82f6, #8b5cf6, #06d6a0);
  padding: 4px;
  animation: dh-avatar-rotate 3s linear infinite;
}

.dh-avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.dh-avatar-icon {
  font-size: 48px;
  color: #3b82f6;
  animation: dh-icon-pulse 2s ease-in-out infinite;
}

.dh-neural-network {
  position: absolute;
  width: 200px;
  height: 200px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.3;
}

.dh-neural-node {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #3b82f6;
  border-radius: 50%;
  animation: dh-node-pulse 2s ease-in-out infinite;
}

.dh-neural-node:nth-child(1) { top: 20%; left: 20%; animation-delay: 0s; }
.dh-neural-node:nth-child(2) { top: 20%; right: 20%; animation-delay: 0.2s; }
.dh-neural-node:nth-child(3) { top: 50%; left: 10%; animation-delay: 0.4s; }
.dh-neural-node:nth-child(4) { top: 50%; right: 10%; animation-delay: 0.6s; }
.dh-neural-node:nth-child(5) { bottom: 20%; left: 30%; animation-delay: 0.8s; }
.dh-neural-node:nth-child(6) { bottom: 20%; right: 30%; animation-delay: 1s; }

.dh-loading-content {
  text-align: center;
  z-index: 1;
}

.dh-loading-title {
  font-size: 32px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 16px;
  animation: dh-text-glow 2s ease-in-out infinite;
}

.dh-loading-subtitle {
  font-size: 18px;
  color: #94a3b8;
  margin-bottom: 8px;
  animation: dh-fade-in-out 3s ease-in-out infinite;
}

.dh-loading-description {
  font-size: 14px;
  color: #64748b;
  animation: dh-fade-in-out 3s ease-in-out infinite 0.5s;
}

.dh-progress-bar {
  width: 300px;
  height: 4px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 2px;
  margin: 32px auto 0;
  overflow: hidden;
  position: relative;
}

.dh-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6, #06d6a0);
  border-radius: 2px;
  animation: dh-progress-flow 2s ease-in-out infinite;
}

.dh-data-particles {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.dh-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #3b82f6;
  border-radius: 50%;
  animation: dh-particle-float 6s linear infinite;
}

.dh-particle:nth-child(1) { left: 10%; animation-delay: 0s; }
.dh-particle:nth-child(2) { left: 20%; animation-delay: 1s; }
.dh-particle:nth-child(3) { left: 30%; animation-delay: 2s; }
.dh-particle:nth-child(4) { left: 40%; animation-delay: 3s; }
.dh-particle:nth-child(5) { left: 50%; animation-delay: 4s; }
.dh-particle:nth-child(6) { left: 60%; animation-delay: 5s; }
.dh-particle:nth-child(7) { left: 70%; animation-delay: 0.5s; }
.dh-particle:nth-child(8) { left: 80%; animation-delay: 1.5s; }
.dh-particle:nth-child(9) { left: 90%; animation-delay: 2.5s; }

/* 动画关键帧 */
@keyframes dh-bg-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

@keyframes dh-avatar-rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes dh-icon-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

@keyframes dh-node-pulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.5); }
}

@keyframes dh-text-glow {
  0%, 100% { text-shadow: 0 0 20px rgba(59, 130, 246, 0.3); }
  50% { text-shadow: 0 0 30px rgba(59, 130, 246, 0.6), 0 0 40px rgba(59, 130, 246, 0.3); }
}

@keyframes dh-fade-in-out {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

@keyframes dh-progress-flow {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400px); }
}

@keyframes dh-particle-float {
  0% {
    transform: translateY(100vh) scale(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
    transform: translateY(90vh) scale(1);
  }
  90% {
    opacity: 1;
    transform: translateY(-10vh) scale(1);
  }
  100% {
    transform: translateY(-20vh) scale(0);
    opacity: 0;
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .dh-styles-grid {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 8px;
  }

  .dh-style-thumb {
    width: 56px;
    height: 56px;
  }

  .dh-style-name {
    font-size: 11px;
  }

  /* 全屏动画移动端适配 */
  .dh-ai-avatar {
    width: 100px;
    height: 100px;
    margin-bottom: 32px;
  }

  .dh-avatar-circle {
    width: 100px;
    height: 100px;
  }

  .dh-avatar-icon {
    font-size: 40px;
  }

  .dh-loading-title {
    font-size: 28px;
  }

  .dh-loading-subtitle {
    font-size: 16px;
  }

  .dh-progress-bar {
    width: 250px;
  }

  .dh-neural-network {
    width: 160px;
    height: 160px;
  }
}

.dh-select-voice-btn {
  width: 100%;
  border: 1px solid #cbd5f5;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dh-select-voice-btn:hover {
  background: #e0ecff;
}

.dh-mode-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.dh-mode-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dh-mode-btn i {
  font-size: 14px;
}

.dh-mode-btn:hover {
  background: #eef2ff;
  color: #1d4ed8;
  border-color: #c7d2fe;
}

.dh-mode-btn.active {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 12px 20px rgba(37, 99, 235, 0.2);
}

.dh-mode-note {
  margin: 0;
  font-size: 12px;
  color: #64748b;
}

.dh-hidden-input {
  display: none;
}

.dh-audio-upload {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dh-audio-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.dh-audio-buttons {
  display: flex;
  gap: 12px;
  align-items: center;
}

.dh-audio-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
}

.dh-audio-preview {
  width: 100%;
  border-radius: 12px;
  background: #0f172a;
}

.dh-audio-note {
  margin: 0;
  font-size: 12px;
  color: #64748b;
}

.dh-uploading-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #475569;
}

.dh-error-text {
  color: #ef4444;
  font-size: 12px;
  margin: 0;
}

.dh-actions {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.dh-actions button {
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  padding: 14px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dh-actions button span.dh-credit {
  font-size: 12px;
  font-weight: 400;
}

.dh-actions .dh-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow: 0 18px 30px rgba(37, 99, 235, 0.25);
}

.dh-actions .dh-primary:hover {
  transform: translateY(-1px);
}

.dh-actions .dh-secondary {
  background: #ffffff;
  color: #1e3a8a;
  border: 1px solid #cbd5f5;
}

.dh-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
  box-shadow: none;
}

.dh-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
}

.dh-modal {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  padding: 20px;
}

.dh-modal-content {
  width: min(780px, 100%);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 34px 60px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 60px);
}

.dh-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.dh-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #0f172a;
}

.dh-modal-close {
  border: none;
  background: none;
  color: #94a3b8;
  font-size: 20px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.dh-modal-close:hover {
  color: #1f2937;
}

.dh-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dh-modal-footer {
  padding: 18px 24px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.dh-btn {
  border: none;
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dh-btn-block {
  width: 100%;
}

.dh-btn-primary {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 12px 20px rgba(37, 99, 235, 0.25);
}

.dh-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.dh-btn-secondary {
  background: #f1f5f9;
  color: #0f172a;
}

.dh-btn-link {
  background: none;
  border: none;
  color: #ef4444;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.dh-btn-link:hover {
  text-decoration: underline;
}

.dh-upload-area {
  border: 2px dashed #cbd5f5;
  border-radius: 16px;
  padding: 28px;
  text-align: center;
  color: #475569;
  background: #f8fbff;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.dh-upload-area:hover {
  border-color: #2563eb;
  background: #e8f1ff;
}

.dh-upload-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.dh-upload-preview img {
  max-width: 200px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.dh-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dh-form-group label {
  font-size: 13px;
  font-weight: 500;
  color: #0f172a;
}

.dh-form-group textarea {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  resize: vertical;
  min-height: 120px;
  font-size: 13px;
  color: #0f172a;
}

.dh-form-group textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  outline: none;
}

.dh-char-meter {
  display: flex;
  justify-content: flex-end;
  font-size: 11px;
  color: #94a3b8;
}

.dh-scene-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

.dh-scene-option {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  background: #f8fafc;
  color: #1e293b;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s ease;
}

.dh-scene-option i {
  font-size: 20px;
  color: #2563eb;
}

.dh-scene-option span {
  font-size: 12px;
  font-weight: 500;
}

.dh-scene-option.selected {
  border-color: #2563eb;
  background: #e0ecff;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.15);
}

.dh-modal-status {
  text-align: center;
  color: #475569;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.dh-modal-status .dh-spinner {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

.dh-modal-result {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.dh-modal-result img {
  max-width: min(420px, 100%);
  border-radius: 14px;
  border: 1px solid #e2e8f0;
}

/* 图片预览样式 */
.image-section {
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 60vh;
  overflow: hidden;
}

.preview-image {
  max-width: 100%;
  max-height: 60vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

@media (max-width: 1280px) {
  .digital-human-app {
    grid-template-columns: 280px minmax(0, 1fr) 320px;
  }
}

@media (max-width: 1100px) {
  .digital-human-app {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
  }

  .digital-human-app .dh-column + .dh-column {
    margin-top: 18px;
  }
}

@media (max-width: 720px) {
  body.digital-human-page {
    padding-top: 56px !important;
  }

  .digital-human-app {
    padding: 12px;
  }

  .dh-card {
    padding: 16px;
  }

  .dh-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dh-template-grid {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }

  .dh-actions button {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .dh-modal {
    padding: 12px;
  }
}

/* Scene Change Popup Styles */
.scene-change-popup {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  border: 1px solid #e5e7eb;
  max-width: 600px;
  z-index: 9999;
}

/* Ensure popup wrapper has correct positioning context */
.popup-wrapper[data-relative="true"] {
  position: relative;
  z-index: 9999;
}

/* Specific positioning for scene change popup - 强制正确定位 */
.popup-panel[data-position="relative"].scene-change-popup {
  position: absolute !important;
  z-index: 10000;
  /* 防止被其他样式覆盖位置 */
  margin: 0 !important;
  transform: none !important;
}

/* 确保弹窗容器不会影响定位 */
.popup-container .popup-wrapper[data-relative="true"] .popup-panel.scene-change-popup {
  position: absolute !important;
}

.scene-change-popup .scene-popup-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 0;
}

.scene-change-popup .scene-popup-header h6 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #374151;
}

.scene-change-popup .scene-change-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
}

.scene-change-popup .form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scene-change-popup .form-group label {
  font-weight: 600;
  color: #374151;
  font-size: 14px;
}

.scene-change-popup .form-group label span {
  font-weight: normal;
  color: #6b7280;
}

.scene-change-popup .scene-options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.scene-change-popup .scene-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #ffffff;
  min-height: 60px;
  text-align: center;
}

.scene-change-popup .scene-option:hover {
  border-color: #3b82f6;
  background: #eff6ff;
}

.scene-change-popup .scene-option.selected {
  border-color: #3b82f6;
  background: #eff6ff;
  color: #3b82f6;
}

.scene-change-popup .scene-option i {
  font-size: 20px;
  margin-bottom: 4px;
  color: inherit;
}

.scene-change-popup .scene-option span {
  font-size: 11px;
  font-weight: 500;
  color: inherit;
  line-height: 1.2;
}

.scene-change-popup #scenePrompt {
  width: 100%;
  min-height: 60px;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  resize: vertical;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  box-sizing: border-box;
}

.scene-change-popup #scenePrompt:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.scene-change-popup .char-counter {
  text-align: right;
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
}

/* Popup Footer Styles */
.scene-change-popup .popup-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
}

.scene-change-popup .popup-footer .btn {
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 100px;
}

.scene-change-popup .popup-footer .btn-secondary {
  background: #f3f4f6;
  color: #374151;
}

.scene-change-popup .popup-footer .btn-secondary:hover {
  background: #e5e7eb;
}

.scene-change-popup .popup-footer .btn-primary {
  background: #3b82f6;
  color: #ffffff;
}

.scene-change-popup .popup-footer .btn-primary:hover {
  background: #2563eb;
}

.scene-change-popup .popup-footer .btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  /* 移动端场景切换弹窗居中显示 */
  .popup-panel.scene-change-popup:not([data-position="relative"]) {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 90% !important;
    max-width: 400px !important;
    max-height: 85vh !important;
    overflow-y: auto !important;
  }

  .scene-change-popup .scene-options-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .scene-change-popup .scene-option {
    padding: 8px 6px;
    min-height: 50px;
  }

  .scene-change-popup .scene-option i {
    font-size: 18px;
    margin-bottom: 3px;
  }

  .scene-change-popup .scene-option span {
    font-size: 10px;
  }

  .scene-change-popup .popup-footer {
    flex-direction: column;
    gap: 8px;
  }

  .scene-change-popup .popup-footer .btn {
    width: 100%;
    min-width: auto;
  }

  .scene-change-popup .scene-change-form {
    padding: 16px;
  }
}

/* Scene Change Loading Overlay */
.scene-change-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.97);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: 12px;
}

.scene-loading-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.scene-loading-content .dh-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e5e7eb;
  border-top: 3px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.scene-loading-content p {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  color: #374151;
}

.scene-loading-content small {
  margin: 0;
  font-size: 14px;
  color: #6b7280;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}


/* Digital human create modal: existing avatar confirmation */
.existing-avatar-confirm .confirm-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.existing-avatar-confirm .selected-avatar-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
}

.existing-avatar-confirm .avatar-preview {
    width: 220px;
    height: 220px;
    border-radius: 18px;
    overflow: hidden;
    border: 2px solid #e2e8f0;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.12);
}

.existing-avatar-confirm .avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.existing-avatar-confirm .avatar-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.existing-avatar-confirm .avatar-details h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.existing-avatar-confirm .avatar-details p {
    margin: 0;
    font-size: 14px;
    color: #4b5563;
}


.digital-human-selection .avatars-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.digital-human-selection .avatar-card {
    width: 220px;
    max-width: 220px;
    flex: 0 1 220px;
    text-align: center;
}

.digital-human-selection .avatar-thumbnail {
    width: 80px;
    height: 80px;
    margin: 0 auto 12px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
}

.digital-human-selection .avatar-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
