/* XG Image Editor - 上传前本地图片编辑器 (tc.kgppk.cn) */
.xg-ie-mask {
  position: fixed;
  left: 0; top: 0; right: 0; bottom: 0;
  z-index: 99999;
  background: rgba(6, 10, 18, .84);
  display: none;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.xg-ie-mask.xg-ie-show { display: flex; }

.xg-ie-panel {
  width: min(1160px, 96vw);
  height: min(780px, 94vh);
  min-height: 480px;
  background: #141a24;
  border: 1px solid #26324a;
  border-radius: 14px;
  box-shadow: 0 26px 80px rgba(0, 0, 0, .62);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #e6edf7;
}

/* header */
.xg-ie-head {
  flex: 0 0 auto;
  height: 52px;
  padding: 0 14px 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #232e42;
  background: #182030;
}
.xg-ie-title { font-size: 15px; font-weight: 600; letter-spacing: .3px; }
.xg-ie-badge {
  font-size: 11px;
  font-weight: 400;
  color: #7ee0b0;
  background: rgba(46, 204, 113, .12);
  border: 1px solid rgba(46, 204, 113, .32);
  border-radius: 20px;
  padding: 2px 9px;
  margin-left: 4px;
}
.xg-ie-count { font-size: 12px; color: #8ea0bd; }
.xg-ie-x {
  margin-left: auto;
  width: 30px; height: 30px;
  border: 0; border-radius: 8px;
  background: transparent;
  color: #93a4c0;
  font-size: 20px; line-height: 1;
  cursor: pointer;
}
.xg-ie-x:hover { background: #26314a; color: #fff; }

/* main */
.xg-ie-main { flex: 1 1 auto; display: flex; min-height: 0; }

.xg-ie-left {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  background:
    linear-gradient(45deg, #14181f 25%, transparent 25%, transparent 75%, #14181f 75%),
    linear-gradient(45deg, #14181f 25%, transparent 25%, transparent 75%, #14181f 75%);
  background-color: #0e131b;
  background-size: 22px 22px;
  background-position: 0 0, 11px 11px;
  overflow: hidden;
}
.xg-ie-imgbox {
  position: absolute;
  left: 14px; right: 14px; top: 14px; bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#xgIeImg { display: block; max-width: 100%; max-height: 100%; }
/* 滤镜实时预览 */
.xg-ie-imgbox img,
.xg-ie-imgbox .cropper-container img { filter: var(--xg-ie-filter, none); }
/* 水印实时预览层（非卡片模式） */
.xg-ie-wm {
  position: absolute;
  display: none;
  padding: 2px 4px;
  line-height: 1;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .55);
  white-space: nowrap;
  z-index: 5;
  user-select: none;
}
.xg-ie-wm img { display: block; }

/* 水印设置: 文本/文件输入 */
.xg-ie-txt {
  flex: 1 1 auto;
  min-width: 0;
  background: #0f1726;
  border: 1px solid #2c3a55;
  border-radius: 6px;
  color: #e6edf7;
  padding: 5px 8px;
  font-size: 13px;
  outline: none;
}
.xg-ie-txt:focus { border-color: #3b7cff; }
.xg-ie-file {
  flex: 1 1 auto;
  min-width: 0;
  color: #93a4c0;
  font-size: 12px;
  width: 100%;
}
.xg-ie-file::-webkit-file-selector-button {
  background: #1b2940;
  color: #cdd9ec;
  border: 1px solid #2c3a55;
  border-radius: 5px;
  padding: 3px 8px;
  margin-right: 8px;
  cursor: pointer;
}

/* ---- 卡片模式: 左侧分成「卡片实时预览」+「图标裁剪小窗」---- */
.xg-ie-prev {
  display: none;
  position: absolute;
  left: 14px; right: 14px; top: 14px; bottom: 14px;
  align-items: center;
  justify-content: center;
}
#xgIeCanvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 4px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .6);
  background: #0b1120;
}
.xg-ie-prev-tip {
  color: #7f90ab;
  font-size: 12px;
  text-align: center;
  line-height: 1.8;
}
.xg-ie-hint {
  display: none;
  position: absolute;
  left: 18px; right: 18px;
  bottom: 212px;
  color: #8598b5;
  font-size: 12px;
  pointer-events: none;
}
.xg-ie-hint b { color: #c3d3ea; font-weight: 600; }

.xg-ie-left.is-card .xg-ie-prev {
  display: flex;
  bottom: 216px;
}
.xg-ie-left.is-card .xg-ie-hint { display: block; }
.xg-ie-left.is-card .xg-ie-imgbox {
  top: auto;
  bottom: 14px;
  height: 186px;
  padding: 6px;
  border: 1px dashed #2f3d57;
  border-radius: 8px;
  background: rgba(17, 23, 34, .82);
  overflow: hidden;
}
.xg-ie-left.is-card #xgIeImg { max-height: 100%; }

/* side */
.xg-ie-side {
  flex: 0 0 306px;
  width: 306px;
  border-left: 1px solid #232e42;
  background: #182030;
  overflow-y: auto;
  padding: 12px 14px 18px;
}
.xg-ie-side::-webkit-scrollbar { width: 8px; }
.xg-ie-side::-webkit-scrollbar-thumb { background: #2c3a55; border-radius: 8px; }

.xg-ie-sec { margin-bottom: 16px; }
.xg-ie-sec-t {
  font-size: 12px;
  color: #8ea0bd;
  margin-bottom: 8px;
  letter-spacing: .5px;
  display: flex;
  align-items: center;
}
.xg-ie-sec-t::before {
  content: "";
  width: 3px; height: 12px;
  background: #3b7cff;
  border-radius: 2px;
  margin-right: 7px;
}

.xg-ie-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.xg-ie-b {
  border: 1px solid #2c3a55;
  background: #1d2533;
  color: #cfd9ea;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: .15s;
}
.xg-ie-b:hover { background: #26314a; color: #fff; }
.xg-ie-b.xg-ie-on { background: #2f6bff; border-color: #2f6bff; color: #fff; }

.xg-ie-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
  font-size: 12px;
  color: #aebbd1;
}
.xg-ie-row > label { flex: 0 0 46px; color: #93a4c0; }
.xg-ie-row .xg-ie-val {
  flex: 0 0 46px;
  text-align: right;
  color: #e6edf7;
  font-variant-numeric: tabular-nums;
}

.xg-ie-range {
  -webkit-appearance: none;
  appearance: none;
  flex: 1 1 auto;
  width: 100%;
  height: 4px;
  border-radius: 4px;
  background: #2c3a55;
  outline: none;
  cursor: pointer;
}
.xg-ie-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #3b7cff;
  border: 2px solid #0f1622;
  cursor: pointer;
}
.xg-ie-range::-moz-range-thumb {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #3b7cff;
  border: 2px solid #0f1622;
  cursor: pointer;
}

.xg-ie-sel, .xg-ie-num {
  flex: 1 1 auto;
  width: 100%;
  background: #1d2533;
  border: 1px solid #2c3a55;
  color: #e6edf7;
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 12px;
  outline: none;
}
.xg-ie-sel:focus, .xg-ie-num:focus { border-color: #3b7cff; }

.xg-ie-meta {
  background: #131a26;
  border: 1px solid #232e42;
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 12px;
  line-height: 1.9;
  color: #93a4c0;
}
.xg-ie-meta b { color: #e6edf7; font-weight: 600; }
.xg-ie-meta .xg-ie-est { color: #ffc861; font-weight: 600; }

/* 卡片背景 */
.xg-ie-sec-toggle { color: #cfd9ea; cursor: pointer; user-select: none; }
.xg-ie-sec-toggle label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.xg-ie-sec-toggle input { margin: 0; }
.xg-ie-color {
  width: 32px; height: 24px;
  border: 1px solid #2c3a55; border-radius: 5px;
  background: transparent; padding: 0; cursor: pointer;
}
.xg-ie-color::-webkit-color-swatch-wrapper { padding: 2px; }
.xg-ie-color::-webkit-color-swatch { border: none; border-radius: 3px; }
.xg-ie-color::-moz-color-swatch { border: none; border-radius: 3px; }
.xg-ie-presets { display: flex; gap: 5px; margin-top: 8px; flex-wrap: wrap; }
.xg-ie-presets button {
  width: 28px; height: 22px;
  border: 1px solid #2c3a55; border-radius: 5px;
  cursor: pointer; padding: 0;
  transition: transform .12s;
}
.xg-ie-presets button:hover { transform: translateY(-1px); border-color: #3b7cff; }
.xg-ie-disabled { opacity: .5; cursor: not-allowed !important; }

/* footer */
.xg-ie-foot {
  flex: 0 0 auto;
  padding: 10px 16px;
  border-top: 1px solid #232e42;
  background: #182030;
  display: flex;
  align-items: center;
  gap: 12px;
}
.xg-ie-chk {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #aebbd1;
  cursor: pointer;
  user-select: none;
}
.xg-ie-chk input { margin: 0 0 0 0; }
.xg-ie-foot .xg-ie-btns { margin-left: auto; display: flex; gap: 8px; }
.xg-ie-btn {
  border: 1px solid #2c3a55;
  background: #1d2533;
  color: #cfd9ea;
  font-size: 13px;
  padding: 7px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: .15s;
}
.xg-ie-btn:hover { background: #26314a; color: #fff; }
.xg-ie-btn.xg-ie-primary {
  background: #2f6bff;
  border-color: #2f6bff;
  color: #fff;
  font-weight: 600;
}
.xg-ie-btn.xg-ie-primary:hover { background: #1f5bf5; }
.xg-ie-btn[disabled] { opacity: .55; cursor: not-allowed; }

.xg-ie-loading {
  position: absolute; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(14, 19, 27, .72);
  color: #cfd9ea; font-size: 13px;
  z-index: 9;
}
.xg-ie-loading.xg-ie-show { display: flex; }

/* 上传页：编辑按钮 / 开关 */
.btn-edit-file { color: #3b7cff !important; }
.btn-edit-file:hover { color: #1f5bf5 !important; }
.xg-auto-edit {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 6px;
  font-size: 13px;
  color: #57606f;
  cursor: pointer;
  user-select: none;
  vertical-align: middle;
}
.xg-auto-edit input { margin: 0; }

@media (max-width: 860px) {
  .xg-ie-panel { width: 98vw; height: 96vh; }
  .xg-ie-main { flex-direction: column; }
  .xg-ie-side { flex: 0 0 auto; width: 100%; max-height: 40vh; border-left: 0; border-top: 1px solid #232e42; }
  .xg-ie-left { flex: 1 1 auto; }
}

/* ---- 拼图模式 ---- */
.xg-ie-left.is-collage .xg-ie-imgbox { display: none; }
.xg-ie-left.is-collage .xg-ie-hint { display: none; }
.xg-ie-left.is-collage .xg-ie-prev {
  display: flex;
  top: 14px; bottom: 14px; left: 14px; right: 14px;
  background: #0b1120;
  border-radius: 8px;
}
.xg-ie-collage-add { margin: 4px 0 10px; }
.xg-ie-b-block { width: 100%; }
.xg-ie-collage-list {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 8px 0 12px; max-height: 138px; overflow-y: auto;
  padding: 2px;
}
.xg-ie-collage-thumb {
  position: relative; width: 50px; height: 50px;
  border-radius: 6px; overflow: hidden; border: 1px solid #2f3d57;
  background: #11171f;
}
.xg-ie-collage-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.xg-ie-collage-del {
  position: absolute; top: -3px; right: -3px;
  width: 16px; height: 16px; line-height: 14px; text-align: center;
  border: none; border-radius: 50%;
  background: rgba(200,40,40,.92); color: #fff; cursor: pointer;
  font-size: 12px; padding: 0;
}
.xg-ie-collage-idx {
  position: absolute; left: 2px; bottom: 2px;
  font-size: 10px; color: #fff; background: rgba(0,0,0,.55);
  border-radius: 3px; padding: 0 3px; line-height: 14px;
}
.xg-ie-collage-empty { color: #7f90ab; font-size: 12px; padding: 8px 2px; line-height: 1.6; }
.xg-ie-collage-lay { flex-wrap: wrap; }
.xg-ie-collage-lay .xg-ie-b { min-width: 42px; }
