#tool-body {
  --dcm-bg: #f5f7fa;
  --dcm-panel: #ffffff;
  --dcm-panel2: #eef1f6;
  --dcm-border: #dfe5ee;
  --dcm-text: #1f2937;
  --dcm-muted: #6b7684;
  --dcm-accent: #2563eb;
  --dcm-accent-soft: #eaf1fe;
  --dcm-danger: #dc2626;
  --dcm-ok: #16a34a;
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--dcm-text);
}
.theme-dark-mode #tool-body {
  --dcm-bg: #232629;
  --dcm-panel: #2d3033;
  --dcm-panel2: #383c40;
  --dcm-border: #45494e;
  --dcm-text: #e5e7eb;
  --dcm-muted: #9aa3ae;
  --dcm-accent: #3b82f6;
  --dcm-accent-soft: #24354d;
  --dcm-danger: #f87171;
  --dcm-ok: #4ade80;
}
#tool-body * { box-sizing: border-box; }
#tool-body { background: var(--dcm-bg); border-radius: 8px; padding: 12px; }
#tool-body .dcm-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 6px; border: 1px solid var(--dcm-border);
  background: var(--dcm-panel); color: var(--dcm-text); cursor: pointer; font-size: 13px;
  transition: border-color .15s, background .15s; user-select: none;
}
#tool-body .dcm-btn:hover { border-color: var(--dcm-accent); }
#tool-body .dcm-btn.primary { background: var(--dcm-accent); border-color: var(--dcm-accent); color: #fff; }
#tool-body .dcm-btn.primary:hover { opacity: .9; }
#tool-body .dcm-btn.active { background: var(--dcm-accent); border-color: var(--dcm-accent); color: #fff; }
#tool-body .dcm-btn:disabled { opacity: .45; cursor: default; }
#tool-body .dcm-btn .fa, #tool-body .dcm-btn .layui-icon { font-size: 13px; }

#tool-body .dcm-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
#tool-body #btnClear, #tool-body #btnFolder, #tool-body #btnFiles { display: none; }
#tool-body .dcm-head .privacy {
  margin-left: auto; font-size: 12px; color: var(--dcm-ok);
  display: inline-flex; align-items: center; gap: 4px;
}
#tool-body .dcm-status { font-size: 12px; color: var(--dcm-muted); }

#tool-body #dcmDrop {
  border: 2px dashed var(--dcm-border); border-radius: 10px; background: var(--dcm-panel);
  padding: 40px 20px; text-align: center; transition: border-color .15s, background .15s;
}
#tool-body #dcmDrop.over { border-color: var(--dcm-accent); background: var(--dcm-accent-soft); }
#tool-body #dcmDrop .dz-icon { font-size: 40px; color: var(--dcm-accent); margin-bottom: 12px; }
#tool-body #dcmDrop .dz-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
#tool-body #dcmDrop .dz-sub { font-size: 12.5px; color: var(--dcm-muted); margin-bottom: 16px; line-height: 1.8; }
#tool-body #dcmDrop .dz-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
#tool-body #dcmDrop .dz-steps {
  display: inline-block; text-align: left; font-size: 12px; color: var(--dcm-muted);
  background: var(--dcm-panel2); border-radius: 8px; padding: 10px 14px; line-height: 2;
}
#tool-body #dcmDrop .dz-steps b { color: var(--dcm-text); }

#tool-body #dcmWork { display: none; gap: 10px; height: 72vh; height: 72dvh; min-height: 480px; }
#tool-body #dcmWork.on { display: flex; }
#tool-body #dcmSide {
  width: 250px; min-width: 200px; background: var(--dcm-panel); border: 1px solid var(--dcm-border);
  border-radius: 8px; display: flex; flex-direction: column; overflow: hidden; flex-shrink: 0;
}
#tool-body .side-head {
  padding: 8px 12px; font-size: 12px; color: var(--dcm-muted);
  border-bottom: 1px solid var(--dcm-border); display: flex; justify-content: space-between; align-items: center;
}
#tool-body #dcmSeries { flex: 1; overflow-y: auto; }
#tool-body .study-row {
  padding: 6px 12px; font-size: 11px; color: var(--dcm-muted); background: var(--dcm-panel2);
  border-bottom: 1px solid var(--dcm-border); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#tool-body .sitem {
  position: relative; padding: 8px 12px; cursor: pointer; font-size: 12.5px;
  border-bottom: 1px solid rgba(128,128,128,.12); display: flex; align-items: center; gap: 8px;
}
#tool-body .sitem:hover { background: var(--dcm-panel2); }
#tool-body .sitem.active { background: var(--dcm-accent-soft); border-left: 3px solid var(--dcm-accent); padding-left: 9px; }
#tool-body .sitem .s-main { flex: 1; min-width: 0; }
#tool-body .sitem .s-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tool-body .sitem .s-sub { font-size: 11px; color: var(--dcm-muted); margin-top: 2px; }
#tool-body .sitem .s-badge {
  font-size: 10px; color: var(--dcm-accent); border: 1px solid var(--dcm-accent);
  border-radius: 8px; padding: 0 6px; flex-shrink: 0; line-height: 16px;
}
#tool-body .sitem .s-prog {
  position: absolute; left: 0; bottom: 0; height: 3px; background: var(--dcm-accent); width: 0;
  transition: width .2s;
}

#tool-body #dcmMain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
#tool-body .pt-bar {
  background: var(--dcm-panel); border: 1px solid var(--dcm-border); border-radius: 8px;
  padding: 7px 12px; font-size: 12px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
#tool-body .pt-bar .meta-item { color: var(--dcm-muted); }
#tool-body .pt-bar .meta-item b { color: var(--dcm-text); font-weight: 600; }
#tool-body .pt-bar .pt-toggle { margin-left: auto; padding: 2px 10px; font-size: 11px; }
#tool-body .img-wrap {
  flex: 1; min-height: 0; position: relative; background: #000; border-radius: 8px;
  overflow: hidden; display: flex;
  touch-action: none; user-select: none;
}
#tool-body .img-scroll { flex: 1; min-width: 0; min-height: 0; overflow: auto; display: flex; }
#tool-body #dcmCanvas { margin: auto; display: none; image-rendering: pixelated; background: #000; }
#tool-body .img-msg {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px;
  align-items: center; justify-content: center; color: #9aa3ae; font-size: 13px; padding: 20px; text-align: center;
}
#tool-body .img-msg .fa { font-size: 34px; opacity: .6; }
#tool-body .ovl {
  position: absolute; pointer-events: none; font-size: 12px; color: #e5e7eb;
  text-shadow: 0 1px 2px rgba(0,0,0,.9); line-height: 1.7; z-index: 3;
}
#tool-body #ovlL { top: 8px; left: 10px; }
#tool-body #ovlR { top: 8px; right: 10px; text-align: right; color: #7dd3fc; }
#tool-body #ovlB { bottom: 8px; left: 10px; color: #7dd3fc; font-size: 12px; }
#tool-body .zoom-hint {
  position: absolute; left: 50%; bottom: 14px; z-index: 4;
  transform: translateX(-50%) translateY(4px);
  background: rgba(0,0,0,.68); color: #e5e7eb; font-size: 12px;
  padding: 5px 14px; border-radius: 18px; pointer-events: none;
  white-space: nowrap; opacity: 0;
  transition: opacity .25s, transform .25s;
}
#tool-body .zoom-hint.on { opacity: 1; transform: translateX(-50%) translateY(0); }

#tool-body .ctl-bar {
  background: var(--dcm-panel); border: 1px solid var(--dcm-border); border-radius: 8px;
  padding: 8px 12px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center;
}
#tool-body .ctl { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--dcm-muted); flex-wrap: wrap; min-width: 0; }
#tool-body .ctl .num {
  width: 62px; text-align: center; background: var(--dcm-panel2); color: var(--dcm-text);
  border: 1px solid var(--dcm-border); border-radius: 5px; padding: 3px 4px; font-size: 12px;
}
#tool-body .ctl .num:focus { outline: none; border-color: var(--dcm-accent); }
#tool-body .ctl .dcm-btn { padding: 4px 10px; font-size: 12px; }
#tool-body .tsl { position: relative; width: 130px; height: 18px; cursor: pointer; flex-shrink: 0; touch-action: none; -webkit-user-drag: none; }
#tool-body .tsl .tsl-track {
  position: absolute; left: 0; right: 0; top: 7px; height: 4px; border-radius: 2px; background: var(--dcm-panel2);
  border: 1px solid var(--dcm-border);
}
#tool-body .tsl .tsl-fill {
  position: absolute; left: 0; top: 7px; height: 4px; border-radius: 2px; background: var(--dcm-accent); width: 0;
}
#tool-body .tsl .tsl-thumb {
  position: absolute; top: 1px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--dcm-panel); border: 2px solid var(--dcm-accent); margin-left: -8px; left: 0;
  touch-action: none; user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none;
}
#tool-body .tsl.wide { width: 200px; }
#tool-body .ctl-sep { width: 1px; align-self: stretch; background: var(--dcm-border); }
#tool-body .slice-lab { min-width: 60px; text-align: center; color: var(--dcm-text); font-size: 12px; }

#tool-body .dcm-foot { margin-top: 8px; font-size: 11.5px; color: var(--dcm-muted); text-align: center; }

@media screen and (max-width: 768px) {
  #tool-body #dcmWork { flex-direction: column; height: auto; min-height: 0; }
  #tool-body #dcmSide { width: 100%; min-width: 0; max-height: 150px; order: 2; }
  #tool-body #dcmMain { order: 1; }
  #tool-body .img-wrap { height: 52vh; height: 52dvh; flex: none; }
  #tool-body .ctl-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "axis axis"
      "preset preset"
      "ww wl"
      "slice slice"
      "ops ops";
    align-items: center;
    gap: 10px 12px;
    padding: 10px;
  }
  #tool-body .ctl { flex: none; flex-wrap: nowrap; width: 100%; min-width: 0; }
  #tool-body .ctl .tsl { flex: 1 1 auto; width: auto; min-width: 56px; }
  #tool-body .ctl .num { width: 56px; flex-shrink: 0; }
  #tool-body .ctl-axis { grid-area: axis; width: 100%; }
  #tool-body .ctl-axis .layui-form { display: block !important; width: 100%; }
  #tool-body .ctl-axis .layui-form-select { width: 100%; }
  #tool-body .ctl-preset { grid-area: preset; justify-content: center; flex-wrap: wrap; }
  #tool-body .ctl-ww { grid-area: ww; }
  #tool-body .ctl-wl { grid-area: wl; }
  #tool-body .ctl-slice { grid-area: slice; }
  #tool-body .ctl-ops { grid-area: ops; justify-content: center; flex-wrap: wrap; gap: 8px 10px; }
  #tool-body .zoom-hint { display: none; }
  #tool-body .ctl-sep { display: none; }
  #tool-body .dcm-btn { padding: 5px 10px; font-size: 12px; }
  #tool-body .dcm-btn .fa, #tool-body .dcm-btn .layui-icon { font-size: 12px; }
  #tool-body .slice-lab { min-width: 44px; flex-shrink: 0; }
  #tool-body .pt-bar { flex-wrap: nowrap; overflow-x: auto; }
  #tool-body .pt-bar .meta-item { flex-shrink: 0; }
  #tool-body .pt-bar .pt-toggle { margin-left: 0; flex-shrink: 0; }
  #tool-body #dcmDrop { padding: 28px 14px; }
  #tool-body .dz-steps { display: block; }
}

body.is-fullscreen #tool-body { display: flex; flex-direction: column; }
body.is-fullscreen #tool-body #dcmWork { flex: 1 1 auto; height: auto; min-height: 0; }
body.is-fullscreen #tool-body .img-wrap { min-height: 320px; }
body.is-fullscreen #tool-body .dcm-foot { display: none; }