/* 
 * 游戏素材加工工具 - 波普艺术风格 (Pop Art & Neo-Brutalism) 样式表
 */

/* 引入谷歌字体 */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;800;900&display=swap');

:root {
  --bg-primary: #FBF6EE;      /* 复古淡米黄 */
  --bg-dots: rgba(0, 0, 0, 0.08); /* 网页淡波点颜色 */
  --color-black: #000000;
  --color-white: #ffffff;
  
  /* 波普高饱和对比色 */
  --color-yellow: #FFDE47;    /* 标志性明黄 */
  --color-red: #FF4E4F;       /* 大红色 */
  --color-blue: #387ADF;      /* 宝蓝色 */
  --color-green: #52D3D8;     /* 荧光绿/青色 */
  --color-pink: #FF007F;      /* 荧光粉色 */
  --color-purple: #9A00FF;    /* 荧光紫色 */
  
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --border-thick: 3px solid #000000;
  --shadow-thick: 5px 5px 0px #000000;
  --shadow-active: 1px 1px 0px #000000;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  /* 经典的波普淡波点背景 */
  background-image: radial-gradient(var(--bg-dots) 15%, transparent 15%);
  background-size: 24px 24px;
  color: var(--color-black);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* --- 容器布局 --- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px 60px 20px; /* 大幅增加底部内边距，增大内容（如上传框卡片）与 footer 页脚的距离 */
  flex: 1; /* 撑开剩余视口空间，完美把页脚挤到底部，杜绝底部漏白悬空隙 */
}

/* --- 页头 Header --- */
header {
  background: var(--color-yellow);
  border: none;
  border-bottom: var(--border-thick);
  box-shadow: 0px 4px 0px #000;
  border-radius: 0;
  margin-bottom: 30px;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 25px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 2;
}

/* 页头背景斜线纹理装饰 */
header::before {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: repeating-linear-gradient(45deg, transparent, transparent 15px, rgba(0,0,0,0.03) 15px, rgba(0,0,0,0.03) 30px);
  z-index: 1;
  pointer-events: none;
}

header * {
  z-index: 2;
}

.logo-section h1 {
  font-size: 2.2rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 3px 3px 0px var(--color-white), 6px 6px 0px var(--color-black);
  display: flex;
  align-items: center;
  gap: 15px;
}

.logo-section h1 .logo-img {
  height: 48px;
  width: auto;
  object-fit: contain;
  border-radius: 8px;
  background: transparent;
}

.logo-section p {

  font-weight: 600;
  margin-top: 5px;
  font-size: 0.95rem;
}

.nav-lang {
  display: flex;
  gap: 10px;
}

/* --- 经典波普按钮 --- */
.pop-btn {
  font-family: var(--font-main);
  background: var(--color-white);
  color: var(--color-black);
  border: var(--border-thick);
  box-shadow: 4px 4px 0px var(--color-black);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
  user-select: none;
  text-decoration: none;
}

.pop-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0px var(--color-black);
}

.pop-btn:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0px var(--color-black);
}

.pop-btn.primary {
  background: var(--color-red);
  color: var(--color-white);
}

.pop-btn.primary:hover {
  background: #ff6869;
}

.pop-btn.blue {
  background: var(--color-blue);
  color: var(--color-white);
}

.pop-btn.blue:hover {
  background: #5090f5;
}

.pop-btn.green {
  background: var(--color-green);
  color: var(--color-black);
}

.pop-btn.green:hover {
  background: #73e3e7;
}

.pop-btn.purple {
  background: var(--color-purple);
  color: var(--color-white);
}

.pop-btn.purple:hover {
  background: #b137ff;
}

.pop-btn.disabled {
  background: #e0e0e0 !important;
  color: #a0a0a0 !important;
  box-shadow: 2px 2px 0px var(--color-black) !important;
  transform: none !important;
  cursor: not-allowed !important;
}

/* --- 经典波普卡片 --- */
.pop-card {
  background: var(--color-white);
  border: var(--border-thick);
  box-shadow: var(--shadow-thick);
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 25px;
  position: relative;
}

.pop-card-title {
  font-size: 1.5rem;
  font-weight: 900;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: var(--border-thick);
  padding-bottom: 12px;
}

/* --- 步骤导航条 --- */
.step-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr); /* 5列等分网格，确保Tab两端与下方内容卡片完美对齐 */
  gap: 15px;
  margin-bottom: 30px;
  width: 100%;
}

.step-item {
  background: var(--color-white);
  border: var(--border-thick);
  box-shadow: 4px 4px 0px var(--color-black);
  border-radius: 10px;
  width: 100%; /* 撑满网格宽度 */
  height: 105px; /* 维持高度，从而维持极佳的卡片比例形态 */
  text-align: center;
  font-weight: 800;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  font-size: 1.1rem; /* 稍微放大步骤标题文字 */
}

.step-item .step-num {
  width: 32px; /* 放大圆圈尺寸 */
  height: 32px;
  border: 2px solid #000;
  border-radius: 50%;
  background: var(--color-yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 900;
}

.step-item.active {
  background: var(--color-blue);
  color: var(--color-white);
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0px var(--color-black);
}

.step-item.active .step-num {
  background: var(--color-yellow);
  color: var(--color-black);
}

.step-item.completed {
  border-color: var(--color-black);
  background: #eaffea;
}

.step-item.completed .step-num {
  background: var(--color-green);
  color: var(--color-black);
}

@media (max-width: 820px) {
  .step-bar {
    gap: 10px;
  }
  .step-item {
    height: 75px;
    font-size: 0.85rem;
  }
  .step-item .step-num {
    width: 26px;
    height: 26px;
    font-size: 0.85rem;
  }
}
@media (max-width: 600px) {
  .step-bar {
    grid-template-columns: repeat(3, 1fr); /* 手机端变为3列网格，自动折行 */
  }
  .step-item {
    height: 70px;
  }
}

/* --- 工作区面板布局 --- */
.step-content {
  display: none;
}

.step-content.active {
  display: block;
}

/* --- 步骤一：上传与切片 --- */
.matting-mode-select {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.matting-mode-btn {
  width: 220px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 800;
  padding: 8px 16px;
  border: 2px solid #000;
  border-radius: 20px;
  background: var(--color-white);
  cursor: pointer;
  transition: all 0.15s ease;
}

@media (max-width: 768px) {
  .matting-mode-btn {
    width: auto;
    flex: 1;
    min-width: 110px;
  }
}

.matting-mode-btn.active {
  background: var(--color-black);
  color: var(--color-white);
}

.upload-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 25px;
}

.upload-row.double-bg {
  grid-template-columns: 1fr 1fr;
}

.upload-box {
  border: 3px dashed var(--color-black);
  background: #fbfbfc;
  border-radius: 10px;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  
  /* 强制锁定正方形虚框且水平居中 (符合“上传中的虚框 改为正方形”要求) */
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.upload-box:hover {
  background: #fffdf0;
  border-color: var(--color-red);
}

.upload-box.drag-over {
  background: #f0f7ff;
  border-color: var(--color-blue) !important;
  border-style: solid !important;
  transform: scale(0.98);
}

.upload-box .upload-icon {
  font-size: 2.5rem;
  pointer-events: none;
}

.upload-box h3 {
  font-weight: 900;
  font-size: 1.2rem;
  pointer-events: none;
}

.upload-box p {
  font-size: 0.85rem;
  color: #666;
  font-weight: 600;
  pointer-events: none;
}

.upload-box input[type="file"] {
  display: none;
}

.upload-preview-container {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0; left: 0;
  background: var(--color-white);
  border-radius: 8px;
  padding: 10px;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.upload-preview-container img {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  border: 2px solid #000;
}

.upload-preview-container .remove-img-btn {
  margin-top: 8px;
  font-size: 0.8rem;
  padding: 3px 8px;
  background: var(--color-red);
  color: #fff;
  border: 2px solid #000;
  font-weight: 800;
  border-radius: 4px;
  cursor: pointer;
}

/* 参数调节面板 (用于绿幕与白底抠图) */
.params-panel {
  display: flex;
  flex-direction: column;
  gap: 15px;
  background: #fcfcfc;
  border: 2px solid #000;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
}

.param-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.param-group label {
  font-weight: 800;
  font-size: 0.9rem;
}

.param-group .slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

/* 波普风格滑块 */
.pop-slider {
  -webkit-appearance: none;
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 10px;
  border: 2px solid #000;
  border-radius: 5px;
  background: var(--color-white);
  outline: none;
}

.pop-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #000;
  border-radius: 50%;
  background: var(--color-pink);
  cursor: pointer;
}

.param-val {
  font-weight: 900;
  min-width: 40px;
  text-align: right;
}

/* 切片设置区 */
.slice-setting-section {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 768px) {
  .slice-setting-section {
    grid-template-columns: 1fr 1fr;
  }
}

.quick-templates-box {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.quick-templates-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

/* 波普风格选项卡/单选框按钮 */
.pop-select-btn {
  background: var(--color-white);
  border: 2px solid #000;
  box-shadow: 2px 2px 0px #000;
  border-radius: 6px;
  padding: 10px;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: all 0.1s ease;
}

.pop-select-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0px #000;
}

.pop-select-btn.active {
  background: var(--color-pink);
  color: var(--color-white);
  transform: translate(2px, 2px);
  box-shadow: 0px 0px 0px #000;
}

.custom-grid-input {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.pop-input {
  font-family: var(--font-main);
  border: 2px solid #000;
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 800;
  width: 70px;
  text-align: center;
  outline: none;
}

.pop-input:focus {
  background: var(--color-yellow);
}

/* 大图预览与切网格线 */
.preview-canvas-container {
  border: var(--border-thick);
  box-shadow: 4px 4px 0px #000;
  background: #f6f6f6;
  border-radius: 12px;
  padding: 6px;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  box-sizing: border-box;
}

.preview-canvas-container canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background-image: linear-gradient(45deg, #ccc 25%, transparent 25%), 
                    linear-gradient(-45deg, #ccc 25%, transparent 25%), 
                    linear-gradient(45deg, transparent 75%, #ccc 75%), 
                    linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}

/* 裁剪/压缩步骤中所有的图片缩略图快速切换滑轨样式 */
.step4-slices-list, .step5-slices-list {
  display: flex;
  gap: 8px;
  overflow-x: auto; /* 横向超出可滑动 */
  overflow-y: hidden; /* 隐藏竖向滚动条 */
  padding: 8px;
  margin-top: 12px;
  width: 100%; /* 列表宽度 = 父容器宽度,跟上面标题那行左右对齐 */
  max-width: calc(72px * 8 + 8px * 7 + 16px); /* 维持列表原本的最大宽度 */
  box-sizing: border-box;
  border: var(--border-thick);
  background: #f0f0f0;
  border-radius: 10px;
  max-height: 210px; /* 增高列表轨道以容纳大卡片 */
  align-items: center;
}
.step4-slice-thumb-card, .step5-slice-thumb-card {
  flex: 0 0 100px; /* 增大宽度到 100px */
  border: 2px solid #000;
  border-radius: 8px;
  padding: 6px;
  background: #fff0f5; /* 采用与截图一致的粉红色背景 */
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  box-shadow: 2px 2px 0px #000; /* 重度硬阴影 */
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  height: 180px; /* 增大高度到 180px */
  flex-shrink: 0; /* 防止卡片被压缩 */
}
.step4-slice-thumb-card:hover, .step5-slice-thumb-card:hover {
  background: #ffe4e1;
  transform: translateY(-1px);
}
.step4-slice-thumb-card.active, .step5-slice-thumb-card.active {
  background: var(--color-yellow); /* 激活时变为亮黄色背景 */
  border-color: #000;
  box-shadow: 3px 3px 0px #000;
  transform: scale(1.02);
}
.step4-slice-thumb-card .card-badge, .step5-slice-thumb-card .card-badge {
  position: absolute;
  top: -6px;
  left: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid #000;
  background: var(--color-yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  box-shadow: 1px 1px 0px #000;
  z-index: 5;
}
.step4-slice-thumb-card .card-thumb-wrap, .step5-slice-thumb-card .card-thumb-wrap {
  width: 100%;
  aspect-ratio: 1 / 1; /* 强制缩略图包裹层为正方形 */
  background: #fff; /* 缩略图为白底 */
  border: 1.5px solid #000; /* 带有黑色外边框 */
  border-radius: 4px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-top: 2px;
  margin-bottom: 4px;
}
.step4-slice-thumb-card .card-thumb-wrap canvas, .step5-slice-thumb-card .card-thumb-wrap canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border: none;
  background: transparent;
  margin-bottom: 0;
}
.step4-slice-thumb-card .card-idx, .step5-slice-thumb-card .card-idx {
  font-weight: 800;
  font-size: 0.8rem;
  line-height: 1.1;
  color: #000;
}
.step4-slice-thumb-card .card-dim, .step5-slice-thumb-card .card-dim {
  font-weight: bold;
  font-size: 0.62rem;
  color: #555;
  line-height: 1.1;
  margin-top: 2px;
  white-space: nowrap;
}
.step4-slice-thumb-card .card-download-btn-bottom, .step5-slice-thumb-card .card-download-btn-bottom {
  margin-top: 8px;
  width: 100%;
  height: 24px;
  border: 1.5px solid #000;
  border-radius: 4px;
  background: var(--color-yellow);
  box-shadow: 1px 1px 0px #000;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.1s ease;
}
.step4-slice-thumb-card .card-download-btn-bottom:hover, .step5-slice-thumb-card .card-download-btn-bottom:hover {
  background: #fff;
}
.step4-slice-thumb-card .card-download-btn-bottom:active, .step5-slice-thumb-card .card-download-btn-bottom:active {
  transform: translate(0.5px, 0.5px);
  box-shadow: 0.5px 0.5px 0px #000;
}

/* 横向滚动条美化 */
.step4-slices-list::-webkit-scrollbar, .step5-slices-list::-webkit-scrollbar {
  height: 8px;
}
.step4-slices-list::-webkit-scrollbar-track, .step5-slices-list::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 4px;
}
.step4-slices-list::-webkit-scrollbar-thumb, .step5-slices-list::-webkit-scrollbar-thumb {
  background: var(--color-pink);
  border-radius: 4px;
  border: 1px solid #000;
}

.config-templates-bar {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

/* --- 步骤二：切片抠图卡片网格 --- */
.matted-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 18px;
  margin-bottom: 25px;
}

.matted-card {
  background: var(--color-white);
  border: var(--border-thick);
  box-shadow: 4px 4px 0px #000;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  cursor: default;
  position: relative;
  transition: all 0.15s ease;
}

.matted-card.selected {
  border-color: var(--color-black);
  background: #ffebf2;
}

.matted-card .card-thumb-container {
  border: 2px solid #000;
  border-radius: 6px;
  width: 100%;
  box-sizing: border-box;
  aspect-ratio: 1 / 1;
  background-image: linear-gradient(45deg, #eee 25%, transparent 25%), 
                    linear-gradient(-45deg, #eee 25%, transparent 25%), 
                    linear-gradient(45deg, transparent 75%, #eee 75%), 
                    linear-gradient(-45deg, transparent 75%, #eee 75%);
  background-size: 10px 10px;
  background-position: 0 0, 0 5px, 5px -5px, -5px 0px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 8px;
}

.matted-card .card-thumb-container canvas {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.matted-card .card-info {
  font-weight: 800;
  font-size: 0.85rem;
}

.matted-card .card-index {
  position: absolute;
  top: -8px; left: -8px;
  background: var(--color-yellow);
  color: #000;
  border: 2px solid #000;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 900;
}

/* --- 步骤三：裁剪与改比例 --- */
.crop-resize-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 25px;
}

@media (min-width: 992px) {
  .crop-resize-layout {
    grid-template-columns: 1.11fr 0.9fr !important;
    align-items: stretch; /* 让左右两列等高,跟随视口自适应 */
  }
  /* 右侧控制面板自适应浏览器高度,超出时内部独立滚动 */
  .crop-resize-layout > .control-panel-box {
    max-height: calc(100vh - 260px);
    min-height: 420px;
    overflow-y: auto;
    padding-right: 6px;
    /* 滚动条美化 */
    scrollbar-width: thin;
    scrollbar-color: var(--color-pink) #f0f0f0;
  }
  .crop-resize-layout > .control-panel-box::-webkit-scrollbar {
    width: 8px;
  }
  .crop-resize-layout > .control-panel-box::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
  }
  .crop-resize-layout > .control-panel-box::-webkit-scrollbar-thumb {
    background: var(--color-pink);
    border-radius: 4px;
    border: 1px solid #000;
  }
}

/* 窄屏(< 992px)时单列堆叠,控制面板不做高度限制 */
@media (max-width: 991px) {
  .crop-resize-layout > .control-panel-box {
    max-height: none;
    overflow-y: visible;
  }
}

.canvas-editor-panel {
  border: var(--border-thick);
  box-shadow: 4px 4px 0px #000;
  border-radius: 12px;
  background: #f6f6f6;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  box-sizing: border-box;
}

/* 编辑器容器，用来定位 Canvas 和 SVG 裁剪控制层 */
.editor-container {
  position: relative;
  border: 2px solid #000;
  background-image: linear-gradient(45deg, #ccc 25%, transparent 25%), 
                    linear-gradient(-45deg, #ccc 25%, transparent 25%), 
                    linear-gradient(45deg, transparent 75%, #ccc 75%), 
                    linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  overflow: hidden;
  max-width: 100%;
  max-height: 100%;
  display: inline-block;
}

.editor-container canvas {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* 可视化裁剪覆盖层 */
.crop-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 10;
  pointer-events: none; /* 事件穿透给手柄 */
}

/* 裁剪暗色遮罩 */
.crop-mask {
  fill: rgba(0, 0, 0, 0.55);
}

/* 裁剪框 */
.crop-box-rect {
  fill: transparent; /* transparent 而非 none,使内部空白区域也能响应拖拽 */
  stroke: var(--color-pink);
  stroke-width: 0.5;
  pointer-events: all;
  cursor: move;
  filter: drop-shadow(0 0 1.5px rgba(255, 0, 127, 0.8));
}

/* 九宫格辅助线 - 白色半透明细线 (符合"三分法"构图) */
.crop-grid-lines {
  opacity: 0;
  transition: opacity 0.2s ease;
}
.crop-overlay.active-drag .crop-grid-lines,
.crop-grid-lines.force-show {
  opacity: 1;
}
.grid-line {
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 0.25;
  stroke-dasharray: 1, 1;
}

/* 角手柄 - 白方块 + 粗黑边,中心点定位 */
.crop-handle.corner {
  fill: var(--color-white);
  stroke: var(--color-black);
  stroke-width: 0.4;
  pointer-events: auto;
  filter: drop-shadow(0 0 0.5px rgba(0, 0, 0, 0.5));
  transition: fill 0.1s ease, stroke-width 0.1s ease;
}
.crop-handle.corner:hover {
  fill: var(--color-yellow);
  stroke-width: 0.6;
}

/* 边中点手柄 - 短横/竖条,默认白底黑边,hover 变粉色 */
.crop-handle.side-h, .crop-handle.side-v {
  fill: var(--color-white);
  stroke: var(--color-black);
  stroke-width: 0.3;
  pointer-events: auto;
  filter: drop-shadow(0 0 0.5px rgba(0, 0, 0, 0.5));
  transition: fill 0.1s ease, stroke-width 0.1s ease;
}
.crop-handle.side-h:hover, .crop-handle.side-v:hover {
  fill: var(--color-pink);
  stroke-width: 0.5;
}

/* 各手柄的光标类型 */
#handle-tl, #handle-bl { cursor: nwse-resize; }
#handle-tr, #handle-br { cursor: nesw-resize; }
#handle-t, #handle-b   { cursor: ns-resize; }
#handle-l, #handle-r   { cursor: ew-resize; }

/* 边缘可拖拽区域 - 透明覆盖在裁剪框4条边上,带细微高亮让用户知道可拖 */
.crop-edge {
  fill: transparent;
  pointer-events: all;
  transition: fill 0.15s ease;
}
.crop-edge#edge-t,
.crop-edge#edge-b { cursor: ns-resize; }
.crop-edge#edge-l,
.crop-edge#edge-r { cursor: ew-resize; }
.crop-edge:hover {
  fill: rgba(255, 0, 127, 0.25); /* 悬停时粉色高亮,提示用户可拖 */
}

.control-panel-box {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-tabs {
  display: flex;
  border-bottom: 2px solid #000;
  margin-bottom: 15px;
}

.panel-tab-item {
  width: 220px;
  text-align: center;
  padding: 8px 12px;
  font-weight: 800;
  cursor: pointer;
  background: transparent;
  border: 2px solid transparent;
  border-bottom: none;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  font-family: var(--font-main);
  font-size: 1rem;
  margin-bottom: -2px;
  transition: all 0.15s ease;
}

@media (max-width: 768px) {
  .panel-tab-item {
    width: auto;
    flex: 1;
  }
}

.panel-tab-item.active {
  background: var(--color-yellow);
  border-color: #000;
}

.panel-tab-content {
  display: none;
}

.panel-tab-content.active {
  display: block;
}

.presets-list {
  max-height: min(35vh, 280px); /* 跟随视口高度自适应(35vh 或 280px 取较小) */
  min-height: 100px;
  overflow-y: auto;
  border: 2px solid #000;
  border-radius: 6px;
  padding: 5px;
  margin-bottom: 15px;
  background: #fff;
}

.preset-item {
  padding: 8px 12px;
  font-weight: 800;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.1s ease;
  display: flex;
  justify-content: space-between;
}

.preset-item:hover {
  background: var(--color-yellow);
}

.preset-item.active {
  background: var(--color-blue);
  color: var(--color-white);
}

.preset-item .preset-val {
  opacity: 0.7;
  font-size: 0.85rem;
}

.preset-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 15px;
}

.preset-input-row label {
  font-weight: 800;
}

.preset-input-row .link-btn {
  width: 32px;
  height: 32px;
  border: 2px solid #000;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: #fff;
  font-weight: 800;
}

.preset-input-row .link-btn.active {
  background: var(--color-green);
}

.geom-transforms {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.geom-btn {
  flex: 1;
  font-size: 1.2rem;
  padding: 8px;
  border: 2px solid #000;
  box-shadow: 2px 2px 0px #000;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.geom-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 0px 0px 0px #000;
}

/* 改尺寸选项 */
.resize-options-row {
  display: flex;
  gap: 8px;
  margin-bottom: 15px;
}

.editor-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 15px;
  border-top: 2px solid #000;
  padding-top: 15px;
}

/* --- 步骤四：压缩与打包导出 --- */
.compress-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 25px;
}

@media (min-width: 992px) {
  .compress-layout {
    grid-template-columns: 1.11fr 0.9fr !important;
    align-items: start;
  }
}

/* 对比容器 */
.comparison-container {
  border: var(--border-thick);
  box-shadow: 4px 4px 0px #000;
  border-radius: 12px;
  background: #f6f6f6;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  box-sizing: border-box;
}

.slider-comparison-box {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 2px solid #000;
  overflow: hidden;
  background-image: linear-gradient(45deg, #ccc 25%, transparent 25%), 
                    linear-gradient(-45deg, #ccc 25%, transparent 25%), 
                    linear-gradient(45deg, transparent 75%, #ccc 75%), 
                    linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  user-select: none;
}

.slider-comparison-box canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: contain;
}

.comparison-overlay-right {
  position: absolute;
  top: 0; right: 0;
  width: 50%; height: 100%;
  overflow: hidden;
  border-left: 3px solid var(--color-pink);
}

.comparison-overlay-right canvas {
  position: absolute;
  top: 0; right: 0;
  width: 480px; height: 100%; /* 精确尺寸 */
  max-width: none;
  object-fit: contain;
}

/* 拖拽对比滑块手柄 */
.comparison-handle {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 4px;
  background: var(--color-pink);
  z-index: 20;
  cursor: ew-resize;
  transform: translateX(-50%);
}

.comparison-handle::after {
  content: '↔';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 32px; height: 32px;
  border: 3px solid #000;
  border-radius: 50%;
  background: var(--color-yellow);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.1rem;
  box-shadow: 2px 2px 0px #000;
}

.comp-labels {
  position: absolute;
  bottom: 10px;
  width: 90%;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 25;
}

.comp-label {
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-weight: 800;
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #fff;
}

.compress-info-card {
  background: #fafafa;
  border: 2px solid #000;
  border-radius: 8px;
  padding: 15px;
  margin-top: 15px;
}

.compress-info-item {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.compress-info-item:last-child {
  margin-bottom: 0;
}

/* --- 底部教程 & 科学公式 (SEO) --- */
.seo-footer {
  margin-top: 50px;
  border-top: var(--border-thick);
  padding-top: 30px;
}

.seo-article {
  background: var(--color-white);
  border: var(--border-thick);
  box-shadow: 4px 4px 0px #000;
  border-radius: 12px;
  padding: 30px;
  line-height: 1.7;
}

.seo-article h2 {
  font-size: 1.6rem;
  font-weight: 900;
  margin-bottom: 20px;
  text-transform: uppercase;
  border-bottom: 2px solid #000;
  padding-bottom: 10px;
}

.seo-article h3 {
  font-size: 1.2rem;
  font-weight: 800;
  margin-top: 20px;
  margin-bottom: 10px;
  color: var(--color-blue);
}

.seo-article p {
  margin-bottom: 15px;
  font-weight: 500;
}

.seo-article ul, .seo-article ol {
  margin-left: 20px;
  margin-bottom: 15px;
  font-weight: 500;
}

.math-formula {
  background: #f9f9f9;
  border-left: 4px solid var(--color-pink);
  padding: 15px;
  font-family: 'Courier New', Courier, monospace;
  font-weight: 600;
  font-size: 0.95rem;
  margin: 15px 0;
  border: 1px solid #ddd;
  border-left-width: 4px;
}

/* --- 弹窗 Modal --- */
.pop-modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.pop-modal-content {
  background: var(--color-white);
  border: var(--border-thick);
  box-shadow: 8px 8px 0px #000;
  border-radius: 12px;
  max-width: 90%;
  max-height: 90%;
  width: 600px;
  padding: 25px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 15px;
  animation: modalPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.pop-modal-close {
  position: absolute;
  top: -15px; right: -15px;
  width: 34px; height: 34px;
  background: var(--color-red);
  color: #fff;
  border: 3px solid #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 2px 2px 0px #000;
}

.pop-modal-close:active {
  transform: translate(2px, 2px);
  box-shadow: 0px 0px 0px #000;
}

.pop-modal-body {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #f0f0f0;
  border: 2px solid #000;
  border-radius: 8px;
  padding: 10px;
  overflow: auto;
  max-height: 450px;
}

.pop-modal-body canvas {
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
  background-image: linear-gradient(45deg, #ccc 25%, transparent 25%), 
                    linear-gradient(-45deg, #ccc 25%, transparent 25%), 
                    linear-gradient(45deg, transparent 75%, #ccc 75%), 
                    linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0px;
  border: 1px solid #ccc;
}

/* --- 波普风 Switch 开关 --- */
.pop-switch {
  position: relative;
  display: inline-block;
  width: 54px;
  height: 28px;
  border: 2px solid #000;
  border-radius: 14px;
  background-color: var(--color-white);
  cursor: pointer;
  box-shadow: 2px 2px 0px #000;
  flex-shrink: 0;
}
.pop-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.pop-switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--color-white);
  transition: .15s;
  border-radius: 14px;
}
.pop-switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #000;
  transition: .15s;
  border-radius: 50%;
}
.pop-switch input:checked + .pop-switch-slider {
  background-color: var(--color-green);
}
.pop-switch input:checked + .pop-switch-slider:before {
  transform: translateX(26px);
}
.pop-switch input:disabled + .pop-switch-slider {
  background-color: #eee;
  cursor: not-allowed;
}
.pop-switch input:disabled + .pop-switch-slider:before {
  background-color: #aaa;
}

/* 切片设置组禁用状态样式 */
.slice-config-group.disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

/* --- 新版波普风工具页脚 (pop-footer) --- */
footer.pop-footer {
  margin-top: auto; /* 使用 flex 推送，强制将页脚粘在可视范围最底端 */
  margin-bottom: 0 !important; /* 强制底部外边距为0，彻底消除页脚底部的任何波点背景留白空隙 */
  padding-bottom: 0 !important;
  border-top: 3px solid #000;
  background-color: var(--color-yellow);
  width: 100%;
  box-shadow: 0px -4px 0px #000;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 35px 20px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 25px;
  text-align: center;
}

@media (min-width: 768px) {
  .footer-inner {
    grid-template-columns: 2fr 1fr 1.2fr;
    text-align: left;
  }
}

.footer-brand h4 {
  font-size: 1.25rem;
  font-weight: 900;
  margin-bottom: 12px;
  text-transform: uppercase;
}
.footer-brand p {
  font-size: 0.85rem;
  font-weight: 600;
  color: #222;
  line-height: 1.6;
}

.footer-links h5, .footer-privacy h5 {
  font-size: 1rem;
  font-weight: 900;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.footer-links ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-links ul li {
  margin-bottom: 8px;
}
.footer-links ul li a {
  font-size: 0.85rem;
  font-weight: 700;
  color: #000;
  text-decoration: underline;
}
.footer-links ul li a:hover {
  color: var(--color-red);
}

.footer-privacy p {
  font-size: 0.85rem;
  font-weight: 600;
  color: #222;
  line-height: 1.5;
}

.footer-copyright {
  grid-column: 1 / -1;
  border-top: 2px dashed #000;
  padding-top: 15px;
  margin-top: 15px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 800;
}

/* 分栏排版辅助 */
.upload-matting-layout, .slice-grid-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 25px;
}

@media (min-width: 992px) {
  .upload-matting-layout {
    grid-template-columns: 1.1fr 0.9fr !important;
    align-items: start;
  }
  .slice-grid-layout {
    grid-template-columns: 1.11fr 0.9fr !important;
    align-items: start;
  }
}

.matting-preview-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 25px;
}
@media (min-width: 992px) {
  .matting-preview-layout {
    grid-template-columns: 1.11fr 0.9fr !important;
    align-items: start;
  }
}




