.text-tools-page {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.text-tools-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.text-tools-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.text-tools-label {
  font-size: 12px;
  color: var(--text-muted);
}

.text-tools-textarea {
  width: 100%;
  min-height: 280px;
  font-size: 14px;
  line-height: 1.65;
  resize: vertical;
}

.markdown-preview-page .text-tools-textarea,
.markdown-preview-page .md-preview {
  min-height: 840px;
}

.markdown-preview-page .md-preview {
  max-height: 1560px;
}

.text-tools-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.text-tools-status {
  font-size: 12px;
  color: var(--text-muted);
  margin: 10px 0 0;
  min-height: 1.2em;
}

.text-tools-status.is-error {
  color: var(--red, #f85149);
}

.text-tools-status.is-ok {
  color: var(--green, #3fb950);
}

.md-preview {
  min-height: 280px;
  max-height: 520px;
  overflow: auto;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-muted);
}

.md-preview h1, .md-preview h2, .md-preview h3 {
  color: var(--text);
  margin: 1em 0 0.5em;
  line-height: 1.35;
}

.md-preview h1 { font-size: 1.5rem; }
.md-preview h2 { font-size: 1.25rem; }
.md-preview h3 { font-size: 1.1rem; }

.md-preview p { margin: 0.6em 0; }
.md-preview ul, .md-preview ol { margin: 0.6em 0; padding-left: 1.4em; }
.md-preview code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--bg3);
  padding: 2px 6px;
  border-radius: 4px;
}
.md-preview pre {
  margin: 0.8em 0;
  padding: 12px 14px;
  background: var(--bg3);
  border-radius: var(--radius);
  overflow: auto;
}
.md-preview pre code { background: none; padding: 0; }
.md-preview blockquote {
  margin: 0.8em 0;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
  color: var(--text-faint);
}
.md-preview a { color: var(--accent); }

.regex-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.regex-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding-bottom: 8px;
}

.regex-highlight {
  min-height: 280px;
  max-height: 520px;
  overflow: auto;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-muted);
}

.regex-highlight mark {
  background: rgba(47, 129, 247, 0.28);
  color: var(--text);
  border-radius: 2px;
  padding: 0 1px;
}

.diff-output {
  margin: 0;
  padding: 14px 16px;
  min-height: 120px;
  max-height: 520px;
  overflow: auto;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.diff-add {
  display: block;
  background: rgba(63, 185, 80, 0.12);
  color: #7ee787;
}

.diff-del {
  display: block;
  background: rgba(248, 81, 73, 0.12);
  color: #ffa198;
}

.diff-same {
  display: block;
  color: var(--text-faint);
}

.img-compress-drop {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.img-compress-drop:hover,
.img-compress-drop.is-dragover {
  border-color: var(--accent);
  background: rgba(47, 129, 247, 0.06);
}

.img-compress-drop-title {
  font-size: 14px;
  color: var(--text);
  margin: 0 0 6px;
}

.img-compress-drop-desc {
  font-size: 12px;
  color: var(--text-faint);
  margin: 0;
}

.img-compress-controls {
  margin-top: 18px;
}

.img-compress-options {
  display: grid;
  grid-template-columns: 1fr 140px 120px;
  gap: 12px;
  margin-bottom: 14px;
  align-items: end;
}

.img-compress-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
}

.img-compress-panel {
  min-width: 0;
}

.img-compress-img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg3);
}

@media (max-width: 768px) {
  .text-tools-split {
    grid-template-columns: 1fr;
  }

  .text-tools-textarea,
  .md-preview,
  .regex-highlight {
    min-height: 200px;
  }

  .markdown-preview-page .text-tools-textarea,
  .markdown-preview-page .md-preview {
    min-height: 600px;
  }

  .markdown-preview-page .md-preview {
    max-height: none;
  }

  .img-compress-options,
  .img-compress-preview {
    grid-template-columns: 1fr;
  }
}
