/* 全局基础样式 */
html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  background: #fafafa;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 容器居中且顶部间距较小 */
.container, .header {
  width: 100%;
  max-width: 800px;
  margin: 20px auto;
  background: transparent;
  border-radius: 12px;
  padding: 0 10px;
  box-sizing: border-box;
}

/* 按钮行紧凑 */
.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  align-items: center;
  justify-content: center;
}

/* 控件统一样式 */
input[type="file"],
#clear,
#generate,
.select-dpi input[type="range"] {
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  border: 1px solid #ccc;
  background-color: #fff;
  color: #333;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  transition: transform 0.2s ease, background-color 0.2s ease;
  max-width: 100%;
  box-sizing: border-box;
}

/* 文件输入特殊背景 */
input[type="file"] {
  background: #f5f5f5;
  border-color: #bbb;
}

/* 绿色按钮样式 */
#clear,
#generate {
  background-color: #28a745;
  color: white;
  border: none;
  box-shadow: 0 4px 10px rgba(40, 167, 69, 0.4);
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

#clear:hover,
#generate:hover {
  background-color: #218838;
  box-shadow: 0 6px 14px rgba(33, 136, 56, 0.6);
  transform: scale(1.05);
}

/* 清晰度选择滑块悬浮效果 */
.select-dpi input[type="range"]:hover {
  border-color: #28a745;
  transform: scale(1.05);
}

/* 缩略图容器 */
#thumbnail-container {
  display: none;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 12px;
  max-width: 800px;
  max-height: 600px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 10px;
  background: #fff;
  margin: 20px auto 0;
  box-sizing: border-box;
  display: none;
}

/* 缩略图外层容器，垂直排列，大小固定 */
.thumbnail-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100px;
  height: 140px;
  box-sizing: border-box;
}

/* 缩略图样式 */
.thumbnail {
  width: 100px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  cursor: pointer;
  margin-bottom: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.thumbnail img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.thumbnail:hover img {
  transform: scale(1.1);
  box-shadow: 0 6px 14px rgba(0,0,0,0.25);
}

/* 缩略图下方的删除按钮 */
.delete-button {
  width: 80px;
  padding: 6px 0;
  background-color: rgba(40, 167, 69, 0.9);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  text-align: center;
  box-shadow: 0 4px 10px rgba(40, 167, 69, 0.4);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.delete-button:hover {
  background-color: #218838;
  box-shadow: 0 6px 14px rgba(33, 136, 56, 0.6);
}

/* 生成中提示样式 */
#loading {
  display: none;
  position: fixed;
  z-index: 1001;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 20px;
  background-color: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 18px;
  border-radius: 10px;
  user-select: none;
}

/* 模态框样式 */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  padding-top: 60px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.9);
}

.modal-content {
  margin: auto;
  display: block;
  max-width: 80%;
  max-height: 80%;
  user-select: none;
}

.close {
  position: absolute;
  top: 15px;
  right: 35px;
  color: #fff;
  font-size: 40px;
  font-weight: bold;
  transition: 0.3s;
  cursor: pointer;
  user-select: none;
}

.close:hover,
.close:focus {
  color: #bbb;
  text-decoration: none;
}

/* 统一滑动条背景轨道样式 */
#dpi {
  -webkit-appearance: none;
  appearance: none;
  width: 150px; /* 可以调节长度 */
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  outline: none;
}

/* Chrome / Safari 滑块 */
#dpi::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 36px;            /* 更长 */
  height: 12px;           /* 更扁 */
  background: linear-gradient(to bottom, #28a745, #218838); /* 光泽渐变绿色 */
  border: none;
  border-radius: 6px;     /* 圆角 */
  box-shadow: 0 0 3px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: transform 0.2s ease;
  margin-top: -3px;       /* 垂直居中调整 */
}

#dpi::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

/* Firefox 滑块 */
#dpi::-moz-range-thumb {
  width: 36px;
  height: 12px;
  background: linear-gradient(to bottom, #28a745, #218838);
  border: none;
  border-radius: 6px;
  box-shadow: 0 0 3px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: transform 0.2s ease;
}

#dpi::-moz-range-thumb:hover {
  transform: scale(1.1);
}

/* IE / Edge 滑块 */
#dpi::-ms-thumb {
  width: 36px;
  height: 12px;
  background: linear-gradient(to bottom, #28a745, #218838);
  border: none;
  border-radius: 6px;
  box-shadow: 0 0 3px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: transform 0.2s ease;
}

#dpi::-ms-thumb:hover {
  transform: scale(1.1);
}



/* 响应式调整 */
@media (max-width: 768px) {
  .buttons {
    flex-direction: column;
  }
  .select-dpi {
    margin-left: 0;
    margin-top: 10px;
  }
}