#tool-body {
  --rt-ink: #1f2937;
  --rt-muted: #6b7280;
  --rt-line: #e5e7eb;
  --rt-panel: #ffffff;
  --rt-soft: #f9fafb;
  --rt-canvas: #f3f4f6;
  --rt-primary: #1f2937;
  --rt-primary-hover: #111827;
  --rt-focus: #2563eb;
  --rt-code-bg: #111827;
  --rt-code-ink: #e5e7eb;
  --rt-radius: 10px;
  color: var(--rt-ink);
  font-size: 14px;
  line-height: 1.5;
}
.theme-dark-mode #tool-body {
  --rt-ink: #e5e7eb;
  --rt-muted: #9ca3af;
  --rt-line: #374151;
  --rt-panel: #1f2937;
  --rt-soft: #111827;
  --rt-canvas: #0b1220;
  --rt-primary: #e5e7eb;
  --rt-primary-hover: #ffffff;
  --rt-focus: #60a5fa;
  --rt-code-bg: #030712;
  --rt-code-ink: #d1d5db;
}

#tool-body * { box-sizing: border-box; }

#tool-body .rt-app {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#tool-body .rt-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 2px;
}
#tool-body .rt-header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}
#tool-body .rt-header p {
  margin: 4px 0 0;
  color: var(--rt-muted);
  font-size: 13px;
}
#tool-body .rt-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

#tool-body .rt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  margin: 0;
  border-radius: 8px;
  border: 1px solid var(--rt-line);
  background: var(--rt-panel);
  color: var(--rt-ink);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
  user-select: none;
}
#tool-body .rt-btn:hover {
  border-color: #cbd5e1;
  background: var(--rt-soft);
}
#tool-body .rt-btn-primary {
  background: var(--rt-primary);
  border-color: var(--rt-primary);
  color: #fff;
}
.theme-dark-mode #tool-body .rt-btn-primary {
  color: #111827;
}
#tool-body .rt-btn-primary:hover {
  background: var(--rt-primary-hover);
  border-color: var(--rt-primary-hover);
  color: #fff;
}
.theme-dark-mode #tool-body .rt-btn-primary:hover {
  color: #111827;
}
#tool-body .rt-btn-ghost {
  background: transparent;
}

#tool-body .rt-card {
  background: var(--rt-panel);
  border: 1px solid var(--rt-line);
  border-radius: var(--rt-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#tool-body .rt-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px 0;
  border-bottom: 1px solid var(--rt-line);
  background: var(--rt-soft);
}
#tool-body .rt-tab-list {
  display: flex;
  gap: 4px;
  min-width: 0;
}
#tool-body .rt-tab {
  height: 36px;
  padding: 0 14px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--rt-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px 8px 0 0;
}
#tool-body .rt-tab:hover {
  color: var(--rt-ink);
  background: rgba(0, 0, 0, 0.03);
}
#tool-body .rt-tab.is-active {
  color: var(--rt-ink);
  border-bottom-color: var(--rt-focus);
  background: var(--rt-panel);
}
#tool-body .rt-tab-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  padding-bottom: 8px;
}
#tool-body .rt-tab-actions .rt-btn {
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
}
#tool-body .rt-actions-edit,
#tool-body .rt-actions-html {
  display: none;
}
#tool-body.tab-edit .rt-actions-edit { display: flex; }
#tool-body.tab-html .rt-actions-html { display: flex; }

#tool-body .rt-panel {
  display: none;
  flex-direction: column;
  min-height: 0;
  height: min(640px, 70dvh);
  height: min(640px, 70vh);
}
#tool-body.tab-edit .rt-panel-edit { display: flex; }
#tool-body.tab-html .rt-panel-html { display: flex; }

#tool-body .rt-editor-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
  background: var(--rt-panel);
}
#tool-body .rt-editor-skeleton {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  background: var(--rt-panel);
  pointer-events: none;
}
#tool-body .rt-editor-skeleton.is-hidden {
  display: none;
}
#tool-body .rt-skel-toolbar {
  height: 42px;
  border-bottom: 1px solid var(--rt-line);
  background: var(--rt-soft);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
}
#tool-body .rt-skel-toolbar span {
  display: inline-block;
  height: 18px;
  border-radius: 4px;
  background: var(--rt-line);
  opacity: 0.7;
}
#tool-body .rt-skel-toolbar span:nth-child(1) { width: 28px; }
#tool-body .rt-skel-toolbar span:nth-child(2) { width: 28px; }
#tool-body .rt-skel-toolbar span:nth-child(3) { width: 72px; margin-left: 4px; }
#tool-body .rt-skel-toolbar span:nth-child(4),
#tool-body .rt-skel-toolbar span:nth-child(5),
#tool-body .rt-skel-toolbar span:nth-child(6),
#tool-body .rt-skel-toolbar span:nth-child(7) { width: 22px; }
#tool-body .rt-skel-body {
  flex: 1;
  display: flex;
  align-items: flex-start;
  padding: 18px 16px;
  color: var(--rt-muted);
  font-size: 13px;
}
#tool-body .rt-editor-body .tox-tinymce {
  border: none !important;
  border-radius: 0 !important;
  height: 100% !important;
}
#tool-body .rt-editor-body .tox-editor-header {
  box-shadow: none !important;
  border-bottom: 1px solid var(--rt-line) !important;
  padding: 2px 4px !important;
  display: none;
}
#tool-body .rt-editor-body .tox-sidebar-wrap,
#tool-body .rt-editor-body .tox-edit-area {
  min-height: 0 !important;
}
/* Toolbar as secondary: smaller controls */
#tool-body .rt-editor-body .tox .tox-tbtn {
  width: 26px !important;
  height: 26px !important;
}
#tool-body .rt-editor-body .tox .tox-tbtn svg {
  transform: scale(0.82);
}
#tool-body .rt-editor-body .tox .tox-tbtn--select {
  width: auto !important;
  max-width: 92px !important;
}
#tool-body .rt-editor-body .tox .tox-toolbar__group {
  padding: 0 2px !important;
}
#tool-body .rt-editor-body .tox .tox-statusbar {
  height: 22px !important;
  font-size: 11px !important;
}
#tool-body .rt-editor-body .tox .tox-statusbar__path-item,
#tool-body .rt-editor-body .tox .tox-statusbar__wordcount {
  font-size: 11px !important;
}
#tool-body .rt-editor-body > textarea {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

#tool-body .rt-cleanbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--rt-line);
  background: var(--rt-canvas);
}
#tool-body .rt-clean-label {
  font-size: 12px;
  color: var(--rt-muted);
}
#tool-body .rt-cleanbar .layui-form-checkbox {
  margin: 0 !important;
  padding-left: 24px !important;
}
#tool-body .rt-cleanbar .layui-form-checkbox span {
  font-size: 12px;
  padding-right: 0 !important;
}

#tool-body .rt-code-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  background: var(--rt-code-bg);
}
#tool-body #rt-html-output {
  width: 100%;
  height: 100%;
  border: none;
  resize: none;
  padding: 14px 16px;
  background: transparent;
  color: var(--rt-code-ink);
  font-family: Consolas, "SF Mono", Monaco, "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.6;
  outline: none;
  overflow: auto;
}
#tool-body .rt-empty-tip {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 13px;
  padding: 20px;
  text-align: center;
  pointer-events: none;
}
#tool-body .rt-code-wrap.is-empty .rt-empty-tip { display: flex; }

#tool-body .rt-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  border-top: 1px solid var(--rt-line);
  background: var(--rt-soft);
  color: var(--rt-muted);
  font-size: 12px;
}
#tool-body .rt-foot strong {
  color: var(--rt-ink);
  font-weight: 600;
}

#tool-body .rt-file-input {
  display: none;
}

@media (max-width: 768px) {
  #tool-body .rt-header {
    flex-direction: column;
  }
  #tool-body .rt-tabs {
    flex-direction: column;
    align-items: stretch;
  }
  #tool-body .rt-tab-actions {
    justify-content: flex-start;
  }
  #tool-body .rt-panel {
    height: min(560px, 75dvh);
    height: min(560px, 75vh);
  }
}
.tox-shadowhost.tox-fullscreen, .tox.tox-tinymce.tox-fullscreen{
  z-index: 9999900;
}