/* ===== 工具箱页面 ===== */
.tools-root {
  --tc-bg: #ffffff;
  --tc-text: #2c2f36;
  --tc-muted: #8a9099;
  --tc-border: rgba(0, 0, 0, 0.08);
  --tc-input: #f6f7f9;
  --tc-accent: #425aef;

  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

[data-theme="dark"] .tools-root {
  --tc-bg: #24272e;
  --tc-text: #e8eaee;
  --tc-muted: #9aa0aa;
  --tc-border: rgba(255, 255, 255, 0.1);
  --tc-input: #1c1f25;
  --tc-accent: #8b9bff;
  color-scheme: dark;
}

#article-container .tool-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  margin: 0;
  background: var(--tc-bg);
  color: var(--tc-text);
  border: 1px solid var(--tc-border);
  border-radius: 10px;
}

#article-container .tool-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

#article-container .tool-head h3 {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font-size: 15px;
  font-weight: 600;
  color: var(--tc-text);
}

#article-container .tool-head h3::before {
  display: none;
}

#article-container .tool-head span {
  color: var(--tc-muted);
  font-size: 11px;
}

#article-container .tool-input {
  width: 100%;
  min-height: 96px;
  padding: 10px 12px;
  margin: 0;
  resize: vertical;
  border: 1px solid var(--tc-border);
  border-radius: 8px;
  outline: none;
  background: var(--tc-input) !important;
  color: var(--tc-text) !important;
  box-shadow: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  box-sizing: border-box;
}

#article-container .tool-input:focus {
  border-color: var(--tc-accent);
}

#article-container .tool-input.inline {
  min-height: 38px;
  padding: 8px 12px;
}

#article-container .tool-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

#article-container .tool-row .tool-input {
  flex: 1;
  min-width: 0;
}

#article-container .tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#article-container .tool-btn {
  padding: 6px 14px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--tc-accent);
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

#article-container .tool-btn:hover {
  opacity: 0.88;
}

#article-container .tool-btn.ghost {
  background: transparent;
  color: var(--tc-muted);
  border-color: var(--tc-border);
}

#article-container .tool-output {
  margin: 0;
  padding: 10px 12px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  background: var(--tc-input);
  border: 1px solid var(--tc-border);
  border-radius: 8px;
  color: var(--tc-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
}

#article-container .tool-card.tool-error .tool-output {
  color: #e5484d;
}

[data-theme="dark"] #article-container .tool-card.tool-error .tool-output {
  color: #ff7b7f;
}

#article-container .tool-swatch {
  display: inline-block;
  width: 38px;
  height: 38px;
  flex: none;
  border: 1px solid var(--tc-border);
  border-radius: 8px;
  background: transparent;
}

@media (max-width: 640px) {
  .tools-root {
    grid-template-columns: 1fr;
  }
}
