* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

  span { padding: 3px;}

body {
  background: #0f0f0f;
  color: #e0e0e0;
  overflow: hidden;
  height: 100vh;
}

.container {
  display: flex;
  height: 100vh;
}

/* ========== 左侧面板 ========== */
.left-panel {
  width: 15%;
  background: #141414;
  padding: 20px;
  overflow-y: auto;
  border-right: 1px solid #222;
  border-radius: 0 12px 12px 0;
}

/* ========== 右侧面板 ========== */
.right-panel {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #121212;
}

/* ========== Tab ========== */
.tab-buttons {
  display: flex;
  margin-bottom: 20px;
  gap: 8px;
}
.tab {
  flex: 1;
  padding: 10px;
  background: #1e1e1e;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  color: #aaa;
  transition: all 0.2s ease;
}
.tab:hover {
  background: #2a2a2a;
}
.tab.active {
  background: linear-gradient(135deg, #00f3ff, #05c46b);
  color: #000;
  font-weight: bold;
}
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* ========== 上传区域 ========== */
.upload-area {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 16px 0;
}
.upload-item {
  display: flex;
  gap: 12px;
  position: relative;
}
.upload-col,
.preview-col {
  width: 50%;
}

.upload-placeholder,
.preview-placeholder {
  width: 120px;
  height: 90px;
  border: 2px dashed #333;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #555;
  transition: all 0.3s ease;
  background: #1a1a1a;
}
.upload-placeholder:hover,
.preview-placeholder:hover {
  border-color: #00f3ff;
  color: #00f3ff;
}
.upload-placeholder.drag-over {
  border-color: #00f3ff;
  background: rgba(0, 243, 255, 0.08);
}

.preview-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 8px;
}
.preview-placeholder.has-image img {
  opacity: 1;
}
.preview-placeholder.has-image .placeholder-text {
  display: none !important;
}

.remove-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  background: #ff2a6d;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: none;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s;
}
.remove-btn:hover {
  transform: scale(1.1);
}
.preview-placeholder.has-image:hover .remove-btn,
.slot:hover .remove-btn {
  display: block;
}

/* ========== 比例 & 类型选择 ========== */
.ratio-buttons,
.image-type-selector {
  margin: 16px 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.ratio-btn,
.image-type-selector label {
  padding: 8px 14px;
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 10px;
  cursor: pointer;
  color: #ccc;
  transition: all 0.2s;
}
.ratio-btn:hover,
.image-type-selector label:hover {
  background: #2a2a2a;
  border-color: #00f3ff;
}
.ratio-btn.active,
.image-type-selector input:checked + span {
  background: linear-gradient(135deg, #00f3ff, #05c46b);
  color: #000;
  font-weight: bold;
  border-color: transparent;
border-radius: 5px;
}
.image-type-selector input[type="radio"] {
  display: none;
}

/* ========== 输入框 & 按钮 ========== */
textarea {
  width: 100%;
  height: 90px;
  margin: 12px 0;
  padding: 12px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  color: #fff;
  resize: vertical;
}
textarea:focus {
  outline: none;
  border-color: #00f3ff;
  box-shadow: 0 0 0 2px rgba(0, 243, 255, 0.2);
}

.btn-primary,
.btn-secondary,
#btn-combine,
#btn-compress,
.btn-copy,
.btn-comment {
  padding: 10px 16px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #00f3ff, #05c46b);
  color: #000;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 243, 255, 0.3);
}

.merge-preview,#merge-preview-img {
height: 280px;
}

.btn-secondary,
#btn-combine {
  background: linear-gradient(135deg, #05c46b, #00f3ff);
  color: #000;
}
#btn-compress {
  background: linear-gradient(135deg, #ff2a6d, #ff7b9c);
  color: white;
}
.btn-copy {
  background: linear-gradient(135deg, #00f3ff, #5e60ce);
  color: #000;
}
.btn-comment {
  background: linear-gradient(135deg, #05c46b, #00f3ff);
  color: #000;
}

/* ========== 分镜区域 ========== */
.storyboard-section {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
  align-items: stretch;
}

.storyboard-left {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  flex: 80%;
  min-height: 100px;
    height: 100%;
}

.slot {
  border: 2px dashed #333;
  background: #1a1a1a;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.3s;
height: 100%;
}
.slot:hover {
  border-color: #00f3ff;
}
.slot img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.storyboard-right {
  flex: 20%;
  display: flex;
  flex-direction: column;
}

.merge-preview {
  position: relative;
  height: 280px;
  border: 1px solid #333;
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 12px;
  flex: 1;
}

.merge-controls {
  margin-top: 16px;
  padding: 14px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.compress-control {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ccc;
}
#compress-value {
  min-width: 45px;
  font-weight: bold;
  color: #00f3ff;
}

/* ========== 历史图片 ========== */
.img-history {
  display: flex;
  gap: 20px;
  margin: 16px 0;
  flex-wrap: wrap;
}
.history-category {
  flex: 0 0 calc(33.333% - 14px);
}
.category-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #333;
  color: #00f3ff;
}

.category-slot-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #333;
  color: #535e5f;
}

.js-images,
.cj-images,
.fj-images {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
}

.img-item {
  width: calc(50% - 7px);
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s;
}
.img-item:hover {
  transform: translateY(-3px);
cursor: pointer;
}
.img-item::before {
  content: '';
  display: block;
  padding-top: 133.33%;
}
.img-item img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.img-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 24px;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  justify-content: space-around;
  align-items: center;
  padding: 0 4px;
  z-index: 10;
  border-radius: 10px 10px 0 0;
}
.img-overlay .icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  color: white;
  background: rgba(255, 255, 255, 0.15);
  transition: background 0.2s;
}
.img-overlay .icon:hover {
  background: rgba(0, 243, 255, 0.4);
}
.img-overlay .add-to-storyboard { background: rgba(0, 243, 255, 0.3); }
.img-overlay .add-to-upload { background: rgba(5, 196, 107, 0.3); }
.img-overlay .hide-temp { background: rgba(250, 173, 20, 0.3); }
.img-overlay .delete-perm { background: rgba(245, 34, 45, 0.3); }
.img-item:hover .img-overlay {
  display: flex;
}

/* ========== 视频参考图 ========== */
.ref-img-upload {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin: 16px 0;
}
@media (min-width: 600px) {
  .ref-img-upload {
    flex-direction: row;
    align-items: center;
  }
}
.ref-img-upload label {
  margin-right: 12px;
  color: #ccc;
}
.upload-box {
  width: 60px;
  height: 60px;
  border: 2px dashed #333;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: #1a1a1a;
}
#video-ref-preview {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #333;
}
/* ==========比例尺宽度 ========== */
.custom-width-input {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: #ccc;
  font-size: 14px;
}
.width-input {
  width: 80px;
  padding: 6px 8px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
  color: white;
  text-align: right;
}
.width-input:focus {
  outline: none;
  border-color: #00f3ff;
}


/* ========== 参考图 URL 输入框美化 ========== */
#video-ref-url {
  width: 100%;
  padding: 8px 12px;
  background: #1a1a1a; /* 深灰背景 */
  border: 1px dashed #444; /* 虚线边框 */
  border-radius: 6px; /* 倒角 */
  color: #ccc; /* 浅色文字 */
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

#video-ref-url:focus {
  border-color: #00f3ff; /* 聚焦时蓝色虚线 */
  box-shadow: 0 0 0 2px rgba(0, 243, 255, 0.2);
}



/* ========== 模态框 ========== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-content {
  background: #161616;
  padding: 24px;
  width: 520px;
  border-radius: 16px;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6),
              0 0 0 1px rgba(0, 243, 255, 0.1);
}
.close {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 26px;
  color: #888;
  cursor: pointer;
  transition: color 0.2s;
}
.close:hover {
  color: #ff2a6d;
}

.detail-modal {
  width: 90%;
  max-width: 1200px;
  padding: 0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
}
.modal-body {
  display: flex;
  height: 85vh;
}
.modal-left {
  flex: 1;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #121212;
}
.modal-left img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}
.modal-right {
  width: 320px;
  padding: 24px;
  background: #161616;
  overflow-y: auto;
  border-left: 1px solid #2a2a2a;
}
.user-info {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #2a2a2a;
}
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin-right: 12px;
  background: #333;
}
.username {
  font-weight: 700;
  color: #00f3ff;
}
.prompt-section label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #ccc;
}
#image-prompt {
  word-wrap: break-word;
  margin-bottom: 12px;
  padding: 12px;
  background: #1a1a1a;
  border-radius: 10px;
  border: 1px solid #333;
  color: #fff;
}
.comment-section textarea {
  width: 100%;
  height: 110px;
  padding: 12px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  color: #fff;
  resize: none;
  margin-bottom: 12px;
}

/* ========== 其他 ========== */
.size-info {
  font-size: 13px;
  color: #777;
}
.footer {
  margin-top: 24px;
  text-align: center;
  color: #666;
  font-size: 12px;
}

.loading-spinner {
  width: 70px;
  height: 70px;
  margin: 24px auto;
  border-radius: 50%;
  background: linear-gradient(45deg, #00f3ff, #ff2a6d, #05c46b, #ff7b9c);
  background-size: 400% 400%;
  animation: aurora 2.5s ease infinite;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-weight: bold;
  font-size: 16px;
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.4);
}
@keyframes aurora {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 12px;
}
.btn-video-overlay {
  padding: 10px 20px;
  background: rgba(0, 243, 255, 0.9);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: bold;
  color: #000;
  box-shadow: 0 4px 15px rgba(0, 243, 255, 0.4);
}

/* ========== 自定义确认弹窗（极简版） ========== */
/* ========== 自定义确认弹窗（带柔和进出动画） ========== */
.custom-modal {
  position: fixed;
  z-index: 2000;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(6px);
  
  /* 初始状态：完全透明 + 下移 */
  opacity: 0;
  pointer-events: none; /* 防止遮挡页面点击 */
  transition: opacity 0.3s ease;

  /* 关键：默认隐藏但保留 DOM，便于动画 */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 显示时添加 .show 类 */
.custom-modal.show {
  opacity: 1;
  pointer-events: auto;
}

.custom-modal-content {
  background: #141414;
  padding: 20px;
  border-radius: 12px;
  width: 90%;
  max-width: 300px;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(0, 243, 255, 0.1);
  text-align: center;

  /* 初始：下移 + 轻微缩放 */
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  transition: 
    transform 0.35s cubic-bezier(0.18, 0.89, 0.32, 1.15),
    opacity 0.3s ease;
}

/* 当父容器显示时，内容也淡入滑上 */
.custom-modal.show .custom-modal-content {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.custom-modal-body {
  color: #00f3ff;
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 20px;
  min-height: 60px;
}

.custom-modal-footer {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.custom-modal-footer button {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
  max-width: 120px;
}

.custom-modal-footer .cancel {
  background: #2a2a2a;
  color: #ccc;
}

.custom-modal-footer .cancel:hover {
  background: #333;
  color: #fff;
}

.custom-modal-footer .ok {
  background: linear-gradient(135deg, #ff4d4d, #f78c6b);
  color: #fff;
}

.custom-modal-footer .ok:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(255, 77, 77, 0.35);
}


/* ========== 视频生成弹窗（修复版） ========== */
/* ========== 视频生成弹窗（唯一权威版） ========== */
#video-modal {
  /* 继承自 .custom-modal，无需额外定位 */
}

.video-modal-content {
  width: 90%;
  max-width: 480px;
  padding: 24px;
  text-align: left;
  overflow: hidden;
  background: #161616;
  border-radius: 16px;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(0, 243, 255, 0.1);
}

.video-modal-content .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #2a2a2a;
}

.video-modal-content .modal-header h3 {
  color: #00f3ff;
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.video-modal-content .close {
  font-size: 20px;
  color: #888;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.video-modal-content .close:hover {
  color: #ff2a6d;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #ccc;
  font-size: 14px;
}

.form-group textarea,
.form-group input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  resize: vertical;
}

.form-group textarea:focus,
.form-group input[type="text"]:focus {
  outline: none;
  border-color: #00f3ff;
}

/* ========== 参考图上传 ========== */
.ref-img-upload {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.ref-img-upload input[type="file"] {
  display: none;
}

.ref-img-upload label.upload-trigger {
  padding: 6px 12px;
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #ccc;
}

.ref-img-upload label.upload-trigger:hover {
  border-color: #00f3ff;
}

#video-ref-preview {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #333;
  display: none;
  margin-top: 8px;
}

/* ========== 视频选项 ========== */
.video-options .radio-group {
  display: flex;
  gap: 16px;
  margin-top: 6px;
}

.video-options .radio-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: #ccc;
  font-size: 14px;
}

.video-options input[type="radio"] {
  accent-color: #00f3ff;
}

/* ========== 视频生成按钮 ========== */
#video-modal .btn-primary {
  padding: 12px 24px;
  background: linear-gradient(135deg, #00f3ff, #05c46b);
  color: #000;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  margin-top: 16px;
}

#video-modal .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 243, 255, 0.35);
}


/* 右栏整体使用 flex 垂直布局 */
.right-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden; /* 防止整体滚动 */
}

/* 固定顶部：分镜操作区 */
.storyboard-section.fixed-top {
  flex-shrink: 0; /* 不收缩 */
  padding: 16px;
  background: #1a1a1a;
  border-bottom: 1px solid #2a2a2a;
  /* 如果你希望它完全固定不随页面滚动，也可以加 position: sticky; top: 0; */
}

/* 可滚动的历史区域容器 */
.history-scroll-container {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 16px;
}

/* ========== 响应式优化：移动端适配 ========== */

/* 平板横屏及以下 */
@media (max-width: 1024px) {
  .container {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  .left-panel {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #222;
    padding: 16px;
    max-height: 50vh;
    overflow-y: auto;
  }

  .right-panel {
    width: 100%;
    padding: 16px;
    overflow-y: auto;
    flex: 1;
  }

  /* Tab 按钮换行 */
  .tab-buttons {
    flex-direction: row;
  }

  /* 上传项改为纵向 */
  .upload-item {
    flex-direction: column;
    align-items: center;
  }

  .upload-col, .preview-col {
    width: 100%;
    max-width: 200px;
  }

  /* 分镜区：单行滚动 */
  .storyboard-left {
    grid-template-columns: repeat(4, 80px);
    overflow-x: auto;
    justify-content: start;
    padding-bottom: 8px;
  }

  .slot {
    aspect-ratio: 1 / 1;
  }

  /* 历史图片：两列变一列 */
  .history-category {
    flex: 0 0 100%;
  }

  .img-item {
    width: calc(50% - 7px); /* 保留两列，若太挤可改 100% */
  }

  .modal-content {
    width: 95%;
    max-width: 95%;
    padding: 16px;
  }

  textarea {
    height: 80px;
  }
}

/* 手机竖屏（窄屏） */
@media (max-width: 600px) {
  body {
    font-size: 14px;
  }

  .tab {
    padding: 8px;
    font-size: 14px;
  }

  .ratio-btn, .image-type-selector label {
    padding: 6px 10px;
    font-size: 13px;
  }

  .btn-primary, .btn-secondary {
    padding: 10px;
    font-size: 14px;
  }

  /* 历史图片一列 */
  .img-item {
    width: 100%;
  }

  .storyboard-left {
    grid-template-columns: repeat(4, 70px);
  }

  .merge-preview {
    height: 200px;
  }

  .modal-body {
    flex-direction: column;
    height: auto;
  }

  .modal-left, .modal-right {
    width: 100%;
    padding: 16px;
  }

  .modal-right {
    border-left: none;
    border-top: 1px solid #2a2a2a;
  }
}