#tool-body {
  --sg-card-bg: #ffffff;
  --sg-text: #333;
  --sg-sub: #8a8f99;
  --sg-border: #e6e8eb;
  --sg-hover: #f5f8ff;
  --sg-primary: #3a7bfd;
  --sg-ok: #16b779;
  --sg-err: #e5484d;
  --sg-preview-bg: #f0f1f3;
  --sg-pad-bg: #fafbfc;
  max-width: 900px;
  margin: 0 auto;
  padding-top: 16px;
  padding-bottom: 40px;
  color: var(--sg-text);
}
.theme-dark-mode #tool-body {
  --sg-card-bg: #2d2d2d;
  --sg-text: #e8e8e8;
  --sg-sub: #9a9a9a;
  --sg-border: #3a3a3a;
  --sg-hover: #383838;
  --sg-preview-bg: #1b1b1d;
  --sg-pad-bg: #242424;
}
#tool-body .sg-card {
  background: var(--sg-card-bg);
  border: 1px solid var(--sg-border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
}
.theme-dark-mode #tool-body .sg-card {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}
#tool-body .sg-tips {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--sg-sub);
  margin-bottom: 14px;
  line-height: 1.6;
}
#tool-body .sg-tips .fa { margin-right: 5px; color: var(--sg-ok); }
#tool-body .sg-tips .sg-warn .fa { color: #f5a623; }
#tool-body .sg-section-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
}
#tool-body .sg-section-title .fa { margin-right: 6px; color: var(--sg-primary); }
#tool-body .sg-upload {
  border: 2px dashed var(--sg-border);
  border-radius: 10px;
  background: var(--sg-card-bg);
  padding: 30px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  margin-bottom: 14px;
}
#tool-body .sg-upload:hover,
#tool-body .sg-upload.sg-dragover {
  border-color: var(--sg-primary);
  background: var(--sg-hover);
}
#tool-body .sg-upload .fa {
  font-size: 34px;
  color: var(--sg-primary);
  margin-bottom: 8px;
}
#tool-body .sg-upload p { margin: 0; font-size: 14px; color: var(--sg-sub); }
#tool-body .sg-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 6px;
  border-bottom: 1px solid var(--sg-border);
  flex-wrap: wrap;
}
#tool-body .sg-file:last-child { border-bottom: none; }
#tool-body .sg-file .sg-ficon { color: var(--sg-err); font-size: 20px; flex-shrink: 0; }
#tool-body .sg-file .sg-finfo { flex: 1; min-width: 160px; }
#tool-body .sg-file .sg-fname { font-size: 14px; word-break: break-all; }
#tool-body .sg-file .sg-fsize { font-size: 12px; color: var(--sg-sub); margin-top: 2px; }
#tool-body .sg-file .sg-fstatus { font-size: 13px; min-width: 120px; text-align: center; }
#tool-body .sg-file .st-run { color: var(--sg-primary); }
#tool-body .sg-file .st-ok { color: var(--sg-ok); }
#tool-body .sg-file .st-err { color: var(--sg-err); }
#tool-body .sg-file .sg-fops { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }
#tool-body .sg-file .sg-fops .layui-btn { margin: 0; }
#tool-body .sg-empty {
  text-align: center;
  color: var(--sg-sub);
  font-size: 13px;
  padding: 20px 0;
}
#tool-body .sg-hidden { display: none !important; }
#tool-body .sg-label {
  font-size: 13px;
  color: var(--sg-sub);
  margin-bottom: 8px;
  font-weight: 500;
}
#tool-body .sg-hint {
  font-size: 12px;
  color: var(--sg-sub);
  line-height: 1.6;
  margin: 6px 0 0;
}
#tool-body .sg-hint a { color: var(--sg-primary); }
#tool-body .sg-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  align-items: center;
  margin-bottom: 4px;
}
#tool-body .sg-row .layui-form-radio { margin: 0; padding-right: 0; }
#tool-body .sg-field { margin-bottom: 14px; }
#tool-body .sg-field:last-child { margin-bottom: 0; }
#tool-body .sg-slider-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--sg-sub);
  margin-bottom: 10px;
  font-weight: 500;
}
#tool-body .sg-slider-head b { color: var(--sg-text); font-weight: 600; }
#tool-body .sg-slider-box { padding: 4px 8px 8px; }
#tool-body .sg-color-row { display: flex; align-items: center; gap: 10px; }
#tool-body .sg-pad-wrap {
  border: 1px dashed var(--sg-border);
  border-radius: 8px;
  background: var(--sg-pad-bg);
  overflow: hidden;
  touch-action: none;
}
#tool-body .sg-pad { display: block; width: 100%; height: 180px; cursor: crosshair; }
#tool-body .sg-logo {
  border: 2px dashed var(--sg-border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
}
#tool-body .sg-logo:hover,
#tool-body .sg-logo.sg-dragover { border-color: var(--sg-primary); background: var(--sg-hover); }
#tool-body .sg-logo .fa { font-size: 22px; color: var(--sg-primary); margin-bottom: 6px; }
#tool-body .sg-logo p { margin: 0; font-size: 13px; color: var(--sg-sub); }
#tool-body .sg-logo-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#tool-body .sg-logo-info img {
  width: 72px;
  height: 40px;
  object-fit: contain;
  background: var(--sg-pad-bg);
  border: 1px solid var(--sg-border);
  border-radius: 4px;
}
#tool-body .sg-preview-pick {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}
#tool-body .sg-preview-current-label {
  font-size: 13px;
  color: var(--sg-sub);
  min-width: 0;
  flex: 1 1 100%;
  word-break: break-all;
  overflow-wrap: anywhere;
  line-height: 1.5;
}
#tool-body .sg-preview-select-wrap { flex: 1 1 100%; min-width: 0; max-width: 100%; }
#tool-body .sg-preview-select-wrap .layui-form-select,
#tool-body .sg-preview-select-wrap .layui-select-title,
#tool-body .sg-preview-select-wrap .layui-select-title input { max-width: 100%; }
#tool-body .sg-preview-select-wrap .layui-select-title input {
  overflow: hidden;
  text-overflow: ellipsis;
}
#tool-body .sg-preview-select-wrap .layui-form-select dl dd {
  white-space: normal;
  word-break: break-all;
  overflow-wrap: anywhere;
}
#tool-body .sg-preview-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}
#tool-body .sg-preview-nav .layui-btn { margin: 0; }
#tool-body .sg-preview-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--sg-preview-bg);
  border-radius: 8px;
  padding: 16px;
  min-height: 180px;
}
#tool-body .sg-preview-paper {
  position: relative;
  display: inline-block;
  line-height: 0;
  max-width: 100%;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  background: #fff;
  cursor: crosshair;
  touch-action: none;
}
#tool-body .sg-preview-paper .sg-page {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  max-height: 80dvh;
}
#tool-body .sg-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff;
  border: 1.5px solid var(--sg-primary);
  border-radius: 1px;
  box-sizing: border-box;
  z-index: 2;
}
#tool-body .sg-handle::after {
  content: '';
  position: absolute;
  inset: -8px;
}
#tool-body .sg-handle-nw { left: -5px; top: -5px; cursor: nwse-resize; }
#tool-body .sg-handle-ne { right: -5px; top: -5px; cursor: nesw-resize; }
#tool-body .sg-handle-sw { left: -5px; bottom: -5px; cursor: nesw-resize; }
#tool-body .sg-handle-se { right: -5px; bottom: -5px; cursor: nwse-resize; }
#tool-body .sg-float {
  position: absolute;
  box-sizing: border-box;
  cursor: move;
  user-select: none;
  border: 1px dashed transparent;
  touch-action: none;
}
#tool-body .sg-float:hover,
#tool-body .sg-float.sg-dragging { border-color: var(--sg-primary); }
#tool-body .sg-float img { display: block; width: 100%; height: 100%; pointer-events: none; }
#tool-body .sg-preview-meta {
  font-size: 12px;
  color: var(--sg-sub);
  text-align: center;
  margin-top: 8px;
  line-height: 1.6;
}
#tool-body .sg-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
}
#tool-body .sg-progress { font-size: 13px; color: var(--sg-sub); }
#tool-body .sg-result { display: none; }
#tool-body .sg-result.sg-show { display: block; }
#tool-body .sg-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}
#tool-body .sg-result-head .sg-section-title { margin-bottom: 0; }
#tool-body .sg-place-hint { display: none; }
@media screen and (max-width: 768px) {
  #tool-body .sg-place-hint {
    display: block;
    text-align: center;
    margin-top: 8px;
  }
  #tool-body .sg-handle {
    width: 14px;
    height: 14px;
  }
  #tool-body .sg-handle-nw { left: -7px; top: -7px; }
  #tool-body .sg-handle-ne { right: -7px; top: -7px; }
  #tool-body .sg-handle-sw { left: -7px; bottom: -7px; }
  #tool-body .sg-handle-se { right: -7px; bottom: -7px; }
}
@media screen and (max-width: 640px) {
  #tool-body .sg-file .sg-fstatus { min-width: 0; text-align: left; width: 100%; }
}