/* ========== AI Super Resolution Page ========== */

/* 页面变量 */
:root {
  --sr-color-bg: #f7f8fa;
  --sr-color-white: #ffffff;
  --sr-color-text: #1a1a2e;
  --sr-color-text-secondary: #666680;
  --sr-color-text-muted: #9999b3;
  --sr-color-primary: #6366f1;
  --sr-color-primary-hover: #4f46e5;
  --sr-color-border: #e5e7eb;
  --sr-radius-sm: 8px;
  --sr-radius-md: 12px;
  --sr-radius-lg: 16px;
  --sr-radius-xl: 24px;
  --sr-shadow-card: 0 4px 16px rgba(0, 0, 0, 0.06);
  --sr-shadow-video: 0 8px 32px rgba(0, 0, 0, 0.12);
}
.buttondiv > button {
    margin-top: 16px !important;
    margin-left: 12px !important;
}
.sr-page-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  min-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* 标题区域 */
.sr-header {
  text-align: center;
  margin-bottom: 68px;
}

.sr-main-title {
  font-size: 42px;
  font-weight: 700;
  color: var(--sr-color-text);
  margin: 0 0 12px;
  letter-spacing: -0.5px;
}

.sr-subtitle {
  font-size: 16px;
  color: var(--sr-color-text-secondary);
  margin: 0;
  line-height: 1.6;
}

/* 主内容区 */
.sr-content {
  display: flex;
  gap: 48px;
  align-items: flex-start;
}

/* 左侧视频 */
.sr-video-section {
  flex-shrink: 0;
}

.sr-video {
  width: 450px;
  height: 450px;
  object-fit: cover;
  border-radius: var(--sr-radius-xl);
  border: 2px solid #e5e5e5;
  box-shadow: var(--sr-shadow-video);
  background: #000;
}

/* 右侧上传区域 */
.sr-upload-section {
  flex: 1;
  background: var(--sr-color-white);
  border-radius: var(--sr-radius-lg);
  padding: 32px;
  box-shadow: var(--sr-shadow-card);
  min-height: 450px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.2s ease;
}

.sr-upload-section.sr-dragover {
  border: 2px dashed var(--sr-color-primary);
  background: #f5f3ff;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* 上传按钮 */
.sr-upload-btn {
  width: 100%;
  margin-top:100px;
  max-width: 280px;
  padding: 16px 28px;
  background: var(--sr-color-primary);
  color: white;
  border: none;
  border-radius: var(--sr-radius-md);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.sr-upload-btn:hover {
  background: var(--sr-color-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.sr-upload-btn:active {
  transform: translateY(0);
}

.sr-upload-btn svg {
  width: 20px;
  height: 20px;
}

/* 上传提示 */
.sr-upload-hint {
  font-size: 14px;
  color: var(--sr-color-text-secondary);
  margin: 20px 0 24px;
  text-align: center;
}

.sr-upload-or {
  margin-top:60px;
  font-size: 13px;
  color: var(--sr-color-text-muted);
  margin-bottom: 20px;
  text-align: center;
  position: relative;
}

/* 参考图片 */
.sr-ref-images {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 320px;
}

.sr-ref-img {
  aspect-ratio: 1/1;
  object-fit: cover;
  border-radius: var(--sr-radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  width:40px;
  height:40px;
}

.sr-ref-img:hover {
  border-color: var(--sr-color-primary);
  transform: scale(1.05);
}

.sr-ref-img.active {
  border-color: var(--sr-color-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* 大图预览 */
.sr-img-preview {
  display: none;
  position: fixed;
  z-index: 99999;
  pointer-events: none;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  border: 2px solid #fff;
  background: #fff;
  overflow: hidden;
  width: 360px;
  height: 360px;
}

.sr-img-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sr-img-preview.loaded {
  /* 图片加载后取消固定尺寸，自适应 */
  width: auto;
  height: auto;
  min-width: 100px;
  min-height: 100px;
  max-width: 360px;
  max-height: 360px;
}

/* ========== 高清修复浮动层 ========== */

.sr-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.55);
  justify-content: center;
  align-items: center;
}

.sr-modal-overlay.active {
  display: flex;
}

.sr-modal {
  position: relative;
  width: 600px;
  height: 620px;
  background: #fff;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 16px 64px rgba(0,0,0,0.2);
}

.sr-modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

/* 图片预览容器 */
.sr-img-box {
  position: relative;
  width: 520px;
  height: 520px;
  border-radius: 12px;
  overflow: hidden;
  background: #f0f0f0;
}

.sr-img-box img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.sr-img-enhanced {
  z-index: 1;
  clip-path: inset(0 50% 0 0);
}

/* 磨砂玻璃覆盖层 */
.sr-frost {
  position: absolute;
  inset: 0;
  z-index: 5;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sr-frost-text {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
  letter-spacing: 4px;
}

/* 对比滑动条 */
.sr-compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  cursor: ew-resize;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sr-compare-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  background: #fff;
  box-shadow: 0 0 6px rgba(0,0,0,0.3);
}

.sr-compare-icon {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 36px;
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  color: #6366f1;
  cursor: ew-resize;
  transition: transform 0.15s ease;
}

.sr-compare-icon:hover {
  transform: scale(1.08);
}

.sr-compare-icon svg {
  width: 20px;
  height: 20px;
}

.sr-compare-svg {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 提示文字 */
.sr-modal-tip {
  font-size: 14px;
  color: #999;
  margin: 0;
}

/* 关闭按扭 */
.sr-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 20;
  width: 32px;
  height: 32px;
  background: #f0f0f0;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #666;
  transition: all 0.2s ease;
}

.sr-modal-close:hover {
  background: #e5e5e5;
  color: #333;
}

.sr-modal-close svg {
  width: 18px;
  height: 18px;
}
.result-preview-overlay .preview-actions-bar .img-redraw-open-btn, .result-preview-overlay .preview-actions-bar .psd-export-btn {
    margin-top: 16px !important;
    margin-left: 12px !important;
}
/* 下载按扭 */
.sr-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 28px;
  background: var(--sr-color-primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
      margin-top: 16px !important;
    margin-left: 12px !important;
}

.sr-download-btn:hover {
  background: var(--sr-color-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.sr-download-btn:active {
  transform: translateY(0);
}

/* ========== 风格选择区域 ========== */
.sr-style-section {
  width: 100%;
  max-width: 580px;
  margin-top: 12px;
}

.sr-style-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--sr-color-text);
  margin: 0 0 12px;
  text-align: left;
}

.sr-style-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
}

.sr-style-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 6px;
  border-radius: var(--sr-radius-sm);
  border: 1.5px solid var(--sr-color-border);
  background: var(--sr-color-white);
}

.sr-style-card:hover {
  border-color: var(--sr-color-primary);
  background: #f5f3ff;
}

.sr-style-card.active {
  border-color: var(--sr-color-primary);
  background: #f5f3ff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.sr-style-card img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 4px;
}

.sr-style-card span {
  font-size: 11px;
  color: var(--sr-color-text-secondary);
  text-align: center;
  line-height: 1.2;
}

.sr-download-btn svg {
  width: 18px;
  height: 18px;
}

/* 响应式 */
@media (max-width: 1023px) {
  .sr-content {
    flex-direction: column;
    align-items: center;
  }

  .sr-video-section {
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .sr-video {
    width: 100%;
    max-width: 450px;
    height: auto;
  }

  .sr-upload-section {
    width: 100%;
    min-height: auto;
  }
}

@media (max-width: 767px) {
  .sr-page-wrapper {
    padding: 32px 6px 48px;
  }

  .sr-main-title {
    font-size: 28px;
  }

  .sr-subtitle {
    font-size: 14px;
  }

  .sr-content {
    gap: 32px;
  }

  .sr-upload-section {
    padding: 24px 10px;
  }

  .sr-upload-btn {
    padding: 14px 24px;
    font-size: 15px;
  }

  .sr-ref-images {
    gap: 8px;
  }
}

@media (max-width: 639px) {
  /* 移动端默认隐藏视频区域 */
  .sr-video-section {
    display: none;
  }

  /* 参考图一行显示4个 */
  .sr-ref-images {
    grid-template-columns: repeat(4, 1fr);
    max-width: none;
  }

  /* 移动端参考图尺寸 80x80 */
  .sr-ref-img {
    width: 80px;
    height: 80px;
  }

  /* 移动端去掉参考图点击放大效果 */
  .sr-img-preview {
    display: none !important;
  }

  /* 移动端设计面板宽100% */
  .design-panel {
    width: 100% !important;
    padding: 10px !important;
  }

  /* 移动端页面布局间距 */
  .page-layout {
    padding: 4px !important;
  }

  /* 移动端默认隐藏inspiration-area */
  .inspiration-area {
    display: none;
    justify-content: flex-start;
  }

  /* 移动端inspiration标题适配 */
  .inspiration-header {
    margin-bottom: 12px;
  }

  .inspiration-title {
    font-size: 22px;
  }

  .inspiration-desc {
    font-size: 13px;
  }

  /* 移动端inspiration-hero适配 */
  .inspiration-hero {
    width: 100%;
    overflow-y: auto;
    max-height: none !important;
    min-height: 0;
    display: block;
    padding: 2px;
  }

  .inspiration-hero-placeholder {
    min-width: auto;
    max-width: 100%;
  }
}

/* 操作页面响应式 */
@media (max-width: 1023px) {
  .page-layout {
    flex-direction: column;
    padding: 16px;
  }

  .design-panel {
    width: 100%;
    position: static;
    max-height: none;
    min-height: auto;
  }

  .inspiration-title {
    font-size: 28px;
  }
}

@media (max-width: 767px) {
  .page-layout {
    padding: 12px;
    gap: 20px;
  }

  .design-panel {
    padding: 16px 14px;
    border-radius: 12px;
  }

  .inspiration-title {
    font-size: 24px;
  }

  .inspiration-desc {
    font-size: 13px;
  }

  .start-btn {
    padding: 12px 20px;
    font-size: 15px;
  }
}
#srImgBox { width: 370px; height: 370px; }
.sr-modal-body {gap: 10px !important;}
.sr-modal{width: 680px !important;height:680px !important;}
.sr-transform-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 28px;
    background: var(--sr-color-primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}
.sr-transform-btn:hover {
    background: var(--sr-color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.sr-transform-btn svg {
    width: 18px;
    height: 18px;
}
/* 2列风格网格 */
.sr-style-grid-2col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.sr-style-grid-2col .sr-style-card {
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 6px;
}
.sr-style-grid-2col .sr-style-card img {
    width: 80px;
    height: 80px;
    margin-bottom: 0;
    flex-shrink: 0;
    border-radius: 8px;
}
.sr-style-grid-2col .sr-style-card span {
    font-size: 12px;
}
/* 预览区域对比容器 */
.compare-container {
    position: relative;
    width: 100%;
    min-width: 300px;
    min-height: 300px;
    max-width: 820px;
    max-height: calc(100vh - 220px);
    border-radius: 12px;
    overflow: hidden;
    background: #f0f0f0;
    margin: 0 auto;
}
.compare-container > img {
    display: block;
    width: 100%;
    height: auto;
    max-height: calc(100vh - 220px);
    object-fit: contain;
}
.compare-container .enhanced-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}
/* 对比水印标签 */
.img-label {
    position: absolute;
    bottom: 12px;
    padding: 3px 10px;
    background: rgba(0,0,0,0.35);
    color: rgba(255,255,255,0.8);
    font-size: 11px;
    border-radius: 5px;
    pointer-events: none;
    z-index: 3;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    user-select: none;
}
.label-left {
    left: 12px;
}
.label-right {
    right: 12px;
}
/* 页面布局 */
.page-layout {
    display: flex;
    gap: 32px;
    margin: 0 auto;
    padding: 24px;
    min-height: calc(100vh - 60px);
}
.design-panel {
    width: 480px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 16px;
    padding: 24px 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    min-height: 500px;
    max-height: calc(100vh - 60px);
}
.sr-style-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-height: 0;
}
.sr-style-section::-webkit-scrollbar {
    width: 4px;
}
.sr-style-section::-webkit-scrollbar-track {
    background: transparent;
}
.sr-style-section::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}
.sr-style-section::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}
.start-btn {
    width: 100%;
    padding: 14px 28px;
    background: var(--sr-color-primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    margin-top: 20px;
}
.start-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}
.start-btn:hover {
    background: var(--sr-color-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}
.inspiration-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.inspiration-hero {
    background: #f7f8fa;
    border-radius: 16px;
    padding: 24px;
    min-height: 400px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.inspiration-hero-placeholder {
    width: 100%;
    min-width: 300px;
    max-width: 820px;
}
.inspiration-hero-placeholder .inline-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 20px;
}
.inline-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--sr-color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.inline-loading .loading-text {
    font-size: 14px;
    color: var(--sr-color-text-secondary);
}
.inspiration-header {
    text-align: center;
    margin-bottom: 32px;
    margin-top: 0;
}

.inspiration-title {
    font-size: 38px;
    font-weight: 800;
    color: var(--sr-color-text);
    letter-spacing: -0.02em;
    margin: 0 0 10px;
}

.inspiration-desc {
    font-size: 15px;
    color: var(--sr-color-text-secondary);
    margin: 0;
    line-height: 1.7;
}

/* ========== 移动端 sr-modal 强制覆盖（必须在全局 !important 规则之后） ========== */
@media (max-width: 639px) {
    .sr-modal-overlay {
        align-items: flex-end;
    }

    .sr-modal {
        width: 100% !important;
        max-width: 100vw !important;
        height: auto !important;
        border-radius: 20px 20px 0 0 !important;
        padding: 16px 0 20px;
        overflow: hidden;
    }

    .sr-modal-body {
        width: 100%;
        padding: 0 8px;
        gap: 10px !important;
    }

    #srImgBox {
        width: 100% !important;
        max-width: calc(100vw - 16px) !important;
        height: auto !important;
        aspect-ratio: 1 / 1;
    }

    .sr-compare-line {
        width: 2px;
    }

    .sr-compare-icon {
        width: 36px;
        height: 28px;
    }

    .sr-modal-close {
        top: 12px;
        right: 12px;
    }

    /* 移动端下载按钮出现时调整modal高度为auto */
    .sr-modal[style*="height"] {
        height: auto !important;
    }
}

/* ========== 移动端 H5：设计面板高度自适应，修复"开始生成"按钮被裁剪/遮挡 ========== */
/* 基础 .design-panel 规则位于本文件靠后位置，会覆盖前面 @media 的 max-height:none，
   因此必须在文件末尾再次覆盖：取消视口高度限制，改由整页滚动展示底部按钮 */
@media (max-width: 639px) {
    .design-panel {
        max-height: none !important;
        min-height: auto !important;
    }
    /* 内容随整页滚动，避免在面板内部滚动导致底部"开始生成"按钮被裁剪 */
    .sr-style-section {
        overflow: visible;
    }
    /* 移动端隐藏灵感区域（必须放在文件末尾，否则会被后面的全局 display:flex 覆盖） */
    .inspiration-area {
        display: none;
    }
    /* 移动端inspiration-hero padding（必须放在文件末尾，否则会被后面的全局 padding:24px 覆盖） */
    .inspiration-hero {
        padding: 2px;
    }
}