body { background-color: #18181B; }
.pixelated { image-rendering: pixelated; image-rendering: crisp-edges; }
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; }

/* rounded-[3px] 的核心改动（严格按参考） */
.custom-rounded { border-radius: 3px; }

.viewport-canvas { width: 100% !important; height: 100% !important; display: block; }

/* 服务状态：文字滚动提示 */
.pd-status-text{
  display: block;
  height: 12px;
  line-height: 12px;
  overflow: hidden;
}
.pd-status-line-wrap{
  display: block;
  transform: translateY(0);
}
.pd-status-line{
  display: block;
  height: 12px;
  line-height: 12px;
  white-space: nowrap;
}
.pd-status-clickable{
  cursor: pointer;
}
.pd-status-clickable:hover{
  border-color: rgba(16, 185, 129, 0.4);
  color: #34D399;
}
@keyframes pd-status-scroll-up {
  0% { transform: translateY(0); }
  65% { transform: translateY(0); }
  100% { transform: translateY(-12px); }
}
.pd-status-scroll .pd-status-line-wrap{
  animation: pd-status-scroll-up 1.6s ease forwards;
}
.pd-btn-disabled{
  opacity: 0.6;
  cursor: not-allowed;
}

/* 九宫格：右上角下载按钮 */
.pd-download-btn{
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(9, 9, 11, 0.6);
  border: 1px solid #27272a;
  border-radius: 3px;
  color: #a1a1aa;
  z-index: 5;
  transition: all 0.15s ease;
}
.pd-download-btn svg{
  width: 12px;
  height: 12px;
}
.pd-download-btn:hover{
  color: #34d399;
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}
.pd-download-btn.pd-download-disabled{
  opacity: 0.4;
  cursor: not-allowed;
}
.pd-download-btn:disabled{
  opacity: 0.4;
  cursor: not-allowed;
}

/* 自定义下拉框样式（严格按参考） */
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2352525b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 1em;
}

/* range 硬核样式（用于中间全局控制条） */
input[type=range] { -webkit-appearance: none; appearance: none; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { background: #27272a; height: 4px; border-radius: 2px; }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 12px;
  width: 12px;
  border-radius: 2px;
  background: #10B981;
  cursor: pointer;
  margin-top: -4px;
  border: 2px solid #18181B;
}
input[type=range]::-moz-range-track { background: #27272a; height: 4px; border-radius: 2px; }
input[type=range]::-moz-range-thumb {
  height: 12px;
  width: 12px;
  border-radius: 2px;
  background: #10B981;
  cursor: pointer;
  border: 2px solid #18181B;
}

@keyframes pulse-emerald {
  0% { border-color: #10B981; box-shadow: 0 0 0px #10B981; }
  50% { border-color: #34D399; box-shadow: 0 0 10px #10B981; }
  100% { border-color: #27272A; box-shadow: 0 0 0px #10B981; }
}
/* 针对整个 grid-container 闪烁 */
.grid-flash-active { animation: pulse-emerald 0.5s ease-out; }

/* 交互微动效 */
.btn-emerald {
  background-color: #10B981;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-emerald:hover {
  background-color: #34D399;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

/* Tailwind CDN 不一定带 line-clamp 插件，这里兜底 */
.line-clamp-1{
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/**
 * 9 宫格显示/隐藏动效（不依赖 Tailwind 动态 class）
 */
.pd-grid-anim{
  transition: opacity 0.2s ease, transform 0.2s ease;
  will-change: opacity, transform;
}
.pd-grid-hidden{
  opacity: 0;
  transform: translateY(6px) scale(0.99);
  pointer-events: none;
}
/* 无纹理时彻底隐藏 grid-main-container（JS 会在淡出后加上该类） */
.pd-grid-display-none{
  display: none !important;
}

/**
 * 无纹理占位提示
 */
#pd-grid-empty{
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #09090b; /* zinc-950 */
  border: 1px solid #27272a; /* zinc-800 */
  border-radius: 3px;
  color: #a1a1aa; /* zinc-400 */
}
.pd-grid-empty-inner{
  text-align: center;
  padding: 16px;
}
.pd-grid-empty-img{
  display: block;
  width: 520px;
  max-width: 88%;
  height: auto;
  opacity: 0.1;
  /* 放大时使用正常抗锯齿，避免像素化导致锯齿 */
  image-rendering: auto;
}
.pd-grid-empty-title{
  font-size: 10px;
  letter-spacing: 0.18em;
  font-weight: 800;
  text-transform: uppercase;
  color: #71717a; /* zinc-500 */
}
.pd-grid-empty-sub{
  margin-top: 8px;
  font-size: 10px;
  color: #52525b; /* zinc-600 */
}

/* 生成中卡片动态样式 - 终极修复版 */
/* 使用 transform 移动伪元素本身，而非背景位置，逻辑更可靠 */
@keyframes pd-sheen-scan {
  /* 从左侧完全不可见区域开始 */
  0% { transform: translateX(-100%); }
  /* 移动到右侧完全不可见区域结束 */
  100% { transform: translateX(100%); }
}

.pd-generating-card {
  position: relative;
  background-color: #18181b; /* zinc-950 */
  border: 1px solid #27272a; /* zinc-800 */
  border-radius: 3px;
  /* 必须 hidden 以剪裁伪元素 */
  overflow: hidden;
  /* 强制创建一个新的堆叠上下文，避免子元素 z-index 问题 */
  isolation: isolate;
}

.pd-generating-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  /* 宽度与容器一致 */
  width: 100%;
  
  /* 渐变条：两头完全透明，中间微亮，确保移动进出时无缝 */
  background: linear-gradient(
    90deg,
    transparent 0%,
    transparent 20%,
    rgba(16, 185, 129, 0.1) 50%,
    transparent 80%,
    transparent 100%
  );
  
  /* 初始位置在容器左侧外 */
  transform: translateX(-100%);
  /* 线性匀速动画，无限循环 */
  animation: pd-sheen-scan 2s infinite linear;
  
  /* 确保不遮挡点击 */
  pointer-events: none;
  z-index: 10;
}
