#tool-body {
  --tti-primary: #c2410c;
  --tti-primary-deep: #9a3412;
  --tti-text: #292524;
  --tti-label: #44403c;
  --tti-muted: #78716c;
  --tti-card: #fff;
  --tti-surface: #faf7f2;
  --tti-border: #e7e0d6;
  --tti-chip: #fff;
  --tti-stage: #f3eee6;
  --tti-on: #fff7ed;
  --tti-shadow: 0 10px 28px rgba(80, 50, 20, 0.08);
  color: var(--tti-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
.theme-dark-mode #tool-body {
  --tti-primary: #fb923c;
  --tti-primary-deep: #fdba74;
  --tti-text: #f5f5f4;
  --tti-label: #e7e5e4;
  --tti-muted: #a8a29e;
  --tti-card: #2a2624;
  --tti-surface: #1f1c1a;
  --tti-border: #44403c;
  --tti-chip: #35302c;
  --tti-stage: #1a1816;
  --tti-on: #3b2418;
  --tti-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}
#tool-body .tti-wrap,
#tool-body .tti-wrap * { box-sizing: border-box; }
#tool-body button,
#tool-body input,
#tool-body textarea,
#tool-body select { font-family: inherit; }
#tool-body .tti-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 4px 0 28px;
}
#tool-body .tti-layout {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
#tool-body .tti-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
#tool-body .tti-textblock { position: relative; }
#tool-body .tti-style { position: relative; }
#tool-body .tti-side {
  position: sticky;
  top: 12px;
  align-self: start;
  min-width: 0;
}
@media screen and (max-width: 768px) {
  #tool-body .tti-layout { grid-template-columns: 1fr; }
  #tool-body .tti-main { display: contents; }
  #tool-body .tti-textblock { order: 1; }
  #tool-body .tti-side { order: 2; position: static; }
  #tool-body .tti-style { order: 3; }
}
#tool-body .tti-card {
  background: var(--tti-card);
  border: 1px solid var(--tti-border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--tti-shadow);
  min-width: 0;
}
#tool-body .tti-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--tti-label);
  margin-bottom: 8px;
}
#tool-body .tti-group + .tti-group {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--tti-border);
}
#tool-body .tti-textblock .layui-input-wrap { display: block; }
#tool-body .tti-textblock .layui-input-affix { top: 8px; right: 8px; }
#tool-body #tti-text {
  min-height: 180px;
  margin: 0;
  padding-right: 36px;
  border-radius: 10px;
  border: 1px solid var(--tti-border);
  background: var(--tti-surface);
  color: var(--tti-text);
  line-height: 1.6;
  resize: vertical;
}
#tool-body #tti-text:focus { border-color: var(--tti-primary) !important; }
#tool-body .layui-form-select { width: 100%; }
#tool-body .layui-input {
  border-color: var(--tti-border);
  border-radius: 8px;
  background: var(--tti-surface);
  color: var(--tti-text);
}
.theme-dark-mode #tool-body .layui-input,
.theme-dark-mode #tool-body #tti-text,
.theme-dark-mode #tool-body .tti-hex {
  background: var(--tti-surface);
  color: var(--tti-text);
  border-color: var(--tti-border);
}
#tool-body .tti-field { margin-top: 12px; }
#tool-body .tti-field-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  color: var(--tti-label);
}
#tool-body .tti-field-h span:last-child {
  font-weight: 600;
  color: var(--tti-muted);
}
#tool-body .tti-field .layui-slider { margin: 12px 8px 4px; }
#tool-body .tti-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}
#tool-body .tti-seg {
  display: inline-flex;
  border: 1px solid var(--tti-border);
  border-radius: 8px;
  overflow: hidden;
}
#tool-body .tti-seg button {
  border: 0;
  background: var(--tti-chip);
  color: var(--tti-label);
  height: 34px;
  padding: 0 12px;
  cursor: pointer;
}
#tool-body .tti-seg button + button { border-left: 1px solid var(--tti-border); }
#tool-body .tti-seg button.is-on {
  background: var(--tti-primary);
  color: #fff;
}
#tool-body .tti-seg .fa { margin-right: 4px; }
#tool-body #tti-bold {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--tti-border);
  border-radius: 8px;
  background: var(--tti-chip);
  color: var(--tti-label);
  cursor: pointer;
}
#tool-body #tti-bold.is-on {
  background: var(--tti-primary);
  border-color: var(--tti-primary);
  color: #fff;
}
#tool-body #tti-bold .fa { margin-right: 4px; }
#tool-body .tti-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
#tool-body .tti-color-row .tti-label {
  margin: 0;
  flex: 1;
  min-width: 0;
}
#tool-body .tti-hex {
  width: 96px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--tti-border);
  background: var(--tti-surface);
  color: var(--tti-text);
  padding: 0 8px;
}
#tool-body .tti-schemes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}
#tool-body .tti-scheme {
  border: 2px solid transparent;
  background: transparent;
  border-radius: 8px;
  padding: 2px;
  cursor: pointer;
  color: var(--tti-muted);
  font-size: 12px;
}
#tool-body .tti-scheme.is-on { border-color: var(--tti-primary); color: var(--tti-primary-deep); }
#tool-body .tti-scheme-bg {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font-weight: 700;
  border: 1px solid var(--tti-border);
  margin-bottom: 4px;
}
#tool-body .tti-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}
#tool-body .tti-switch-row .tti-label { margin: 0; }
#tool-body .tti-widths {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
#tool-body .tti-widths button {
  border: 1px solid var(--tti-border);
  background: var(--tti-chip);
  border-radius: 8px;
  padding: 6px 4px;
  cursor: pointer;
  color: var(--tti-label);
}
#tool-body .tti-widths button b { display: block; font-size: 14px; }
#tool-body .tti-widths button span {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--tti-muted);
}
#tool-body .tti-widths button.is-on {
  border-color: var(--tti-primary);
  background: var(--tti-on);
  color: var(--tti-primary-deep);
}
#tool-body .tti-widths button.is-on span { color: inherit; }
#tool-body .tti-pats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
#tool-body .tti-pat {
  border: 2px solid transparent;
  background: transparent;
  border-radius: 8px;
  padding: 3px 3px 4px;
  cursor: pointer;
  color: var(--tti-muted);
  font-size: 12px;
}
#tool-body .tti-pat.is-on { border-color: var(--tti-primary); color: var(--tti-primary-deep); }
#tool-body .tti-pat-swatch {
  display: block;
  height: 36px;
  border-radius: 6px;
  background-color: #f7f3ea;
  border: 1px solid rgba(0, 0, 0, 0.06);
  margin-bottom: 4px;
}
#tool-body .tti-pat-dots {
  background-image: radial-gradient(circle, rgba(60, 40, 20, 0.55) 1px, transparent 1.4px);
  background-size: 8px 8px;
}
#tool-body .tti-pat-grid {
  background-image: linear-gradient(rgba(60, 40, 20, 0.4) 1px, transparent 1px), linear-gradient(90deg, rgba(60, 40, 20, 0.4) 1px, transparent 1px);
  background-size: 8px 8px;
}
#tool-body .tti-pat-lines {
  background-image: repeating-linear-gradient(transparent, transparent 5px, rgba(60, 40, 20, 0.4) 5px, rgba(60, 40, 20, 0.4) 6px);
}
#tool-body .tti-pat-diagonal {
  background-image: repeating-linear-gradient(45deg, transparent, transparent 4px, rgba(60, 40, 20, 0.45) 4px, rgba(60, 40, 20, 0.45) 5px);
}
#tool-body .tti-pat-diamond {
  background-image: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(60, 40, 20, 0.4) 5px, rgba(60, 40, 20, 0.4) 6px), repeating-linear-gradient(-45deg, transparent, transparent 5px, rgba(60, 40, 20, 0.4) 5px, rgba(60, 40, 20, 0.4) 6px);
}
#tool-body .tti-hint {
  display: none;
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--tti-muted);
}
#tool-body .tti-hint.is-show { display: block; }
#tool-body .tti-stage {
  position: relative;
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border-radius: 12px;
  background: var(--tti-stage);
}
#tool-body .tti-font-loading {
  display: none;
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  z-index: 2;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(41, 37, 36, 0.88);
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
}
#tool-body .tti-font-loading .fa { font-size: 14px; }
#tool-body .tti-stage.is-font-loading .tti-font-loading { display: flex; }
#tool-body #tti-font-warmup {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  font-size: 32px;
  opacity: 0;
  pointer-events: none;
}
#tool-body .tti-stage.is-clear {
  background-color: #efeae3;
  background-image:
    linear-gradient(45deg, #e2dbd2 25%, transparent 25%),
    linear-gradient(-45deg, #e2dbd2 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e2dbd2 75%),
    linear-gradient(-45deg, transparent 75%, #e2dbd2 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.theme-dark-mode #tool-body .tti-stage.is-clear {
  background-color: #2a2a2a;
  background-image:
    linear-gradient(45deg, #333 25%, transparent 25%),
    linear-gradient(-45deg, #333 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #333 75%),
    linear-gradient(-45deg, transparent 75%, #333 75%);
}
#tool-body .tti-stage.is-ready {
  min-height: 0;
  max-height: min(70vh, 760px);
  max-height: min(70dvh, 760px);
  overflow: auto;
  align-items: flex-start;
  justify-content: center;
  scrollbar-gutter: stable;
}
#tool-body .tti-stage.is-ready #tti-canvas {
  max-width: none;
  flex: none;
}
#tool-body .tti-stage.is-empty,
#tool-body .tti-stage.is-error {
  background-image: none;
  background-color: var(--tti-surface);
}
#tool-body #tti-canvas {
  display: none;
  max-width: 100%;
  min-width: 0;
  box-shadow: 0 8px 24px rgba(40, 30, 20, 0.12);
}
#tool-body .tti-stage.is-ready #tti-canvas { display: block; }
#tool-body .tti-empty,
#tool-body .tti-error {
  display: none;
  text-align: center;
  color: var(--tti-muted);
  font-size: 14px;
  line-height: 1.6;
  padding: 12px;
}
#tool-body .tti-stage.is-empty .tti-empty { display: block; }
#tool-body .tti-stage.is-error .tti-error { display: block; }
#tool-body .tti-meta {
  min-height: 20px;
  margin: 10px 0;
  text-align: center;
  font-size: 13px;
  color: var(--tti-muted);
}
#tool-body #tti-save {
  margin: 0;
  height: 44px;
  font-size: 15px;
  background: #c2410c;
  border: none;
  color: #fff;
}
#tool-body #tti-save:hover { background: #9a3412; color: #fff; }
#tool-body #tti-save.is-off { opacity: 0.45; cursor: not-allowed; }
#tool-body #tti-save .fa { margin-right: 6px; }
#tool-body .tti-reset {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 6px;
  border: 0;
  background: none;
  color: var(--tti-muted);
  cursor: pointer;
  font-size: 13px;
}
#tool-body .tti-reset:hover { color: var(--tti-primary); }
#tool-body button:focus-visible,
#tool-body textarea:focus-visible,
#tool-body input:focus-visible {
  outline: 2px solid var(--tti-primary);
  outline-offset: 1px;
}