/* Comparar textos — v2 tool styles (client-side only) */

.ctx-intro {
  margin-bottom: 12px;
}

.ctx-privacy {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--dica-border);
  background: var(--dica-surface-soft);
  color: var(--dica-body);
  font-size: 0.92rem;
  line-height: 1.45;
  hyphens: none;
  -webkit-hyphens: none;
  word-break: normal;
  overflow-wrap: anywhere;
}

.ctx-privacy svg {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  fill: var(--dica-action);
  max-width: none;
}

.ctx-privacy strong {
  color: var(--dica-ink);
}

.ctx-privacy-short {
  display: none;
}

.ctx-app {
  box-shadow: 0 0 0 1px var(--dica-border), 0 12px 32px var(--dica-shadow);
  border-radius: 16px;
  margin-bottom: 28px;
  background: var(--dica-surface);
  color: var(--dica-body);
  overflow: hidden;
}

.ctx-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--dica-border);
  background: var(--dica-surface-soft);
}

.ctx-btn {
  appearance: none;
  border: 1px solid var(--dica-border);
  background: var(--dica-surface);
  color: var(--dica-ink);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.ctx-btn:hover {
  border-color: var(--dica-action-border);
  background: var(--dica-action-soft);
}

.ctx-btn:focus-visible {
  outline: none;
  border-color: var(--dica-action);
  box-shadow: 0 0 0 3px var(--dica-action-soft);
}

.ctx-btn-primary {
  background: var(--dica-action);
  border-color: var(--dica-action);
  color: #fff;
}

.ctx-btn-primary:hover {
  filter: brightness(1.05);
  background: var(--dica-action);
  color: #fff;
}

.ctx-btn.is-active {
  background: var(--dica-action-soft);
  border-color: var(--dica-action);
  color: var(--dica-ink);
}

.ctx-toolbar-spacer {
  flex: 1 1 auto;
  min-width: 4px;
}

.ctx-btn-sm {
  padding: 5px 9px;
  font-size: 0.76rem;
  border-radius: 8px;
}

.ctx-view-toggle {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 3px;
  border-radius: 12px;
  border: 1px solid var(--dica-border);
  background: var(--dica-surface);
}

.ctx-view-btn.is-active {
  background: var(--dica-action);
  border-color: var(--dica-action);
  color: #fff;
}

.ctx-view-btn.is-active:hover {
  background: var(--dica-action);
  color: #fff;
  filter: brightness(1.05);
}

.ctx-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.ctx-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 10px 14px 12px;
  border-bottom: 1px solid var(--dica-border);
  background: var(--dica-surface);
  font-size: 0.84rem;
  color: var(--dica-body);
}

.ctx-options label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  cursor: pointer;
  font-weight: 600;
  color: var(--dica-ink);
  user-select: none;
}

.ctx-options input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--dica-action);
  margin: 0;
  cursor: pointer;
}

.ctx-opt-select {
  gap: 8px !important;
}

.ctx-opt-select select {
  appearance: auto;
  max-width: 160px;
  padding: 5px 8px;
  border: 1px solid var(--dica-border);
  border-radius: 8px;
  background: var(--dica-surface-soft);
  color: var(--dica-ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  /* Lets the native OS popup follow light/dark with the site theme */
  color-scheme: light;
}

.ctx-opt-select select:focus {
  outline: none;
  border-color: var(--dica-action);
  box-shadow: 0 0 0 3px var(--dica-action-soft);
}

.ctx-options-tip {
  margin: 0;
  padding: 0 14px 12px;
  border-bottom: 1px solid var(--dica-border);
  background: var(--dica-surface);
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--dica-muted);
}

.ctx-options-tip strong {
  color: var(--dica-ink);
  font-weight: 700;
}

.ctx-empty-state .ctx-empty-steps {
  display: block;
  margin: 8px 0 6px;
  color: var(--dica-body);
  font-size: 0.9rem;
}

.ctx-empty-state .ctx-empty-actions {
  display: block;
  font-size: 0.88rem;
}

.ctx-empty-state .ctx-btn {
  margin-left: 4px;
  vertical-align: middle;
}

.ctx-opt-select select option {
  background-color: var(--dica-surface);
  color: var(--dica-ink);
}

html[data-theme="dark"] .ctx-app,
html[data-theme="dark"] .ctx-opt-select select {
  color-scheme: dark;
}

html[data-theme="dark"] .ctx-opt-select select {
  background-color: var(--dica-surface-raised, var(--dica-surface-soft));
  border-color: var(--dica-border);
  color: var(--dica-ink);
}

html[data-theme="dark"] .ctx-opt-select select option {
  background-color: #1e2229;
  color: #e8eaed;
}

html[data-theme="dark"] .ctx-opt-select select option:checked,
html[data-theme="dark"] .ctx-opt-select select option:hover {
  background-color: #2a3140;
  color: #fff;
}

.ctx-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--dica-border);
  background: var(--dica-surface-soft);
}

.ctx-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--dica-border);
  background: var(--dica-surface);
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--dica-muted);
}

.ctx-stat strong {
  color: var(--dica-ink);
  font-weight: 800;
}

.ctx-stat-add {
  border-color: rgba(15, 122, 63, 0.28);
  background: rgba(15, 122, 63, 0.08);
  color: #0f7a3f;
}

.ctx-stat-add strong {
  color: #0b5c30;
}

.ctx-stat-del {
  border-color: rgba(180, 35, 24, 0.28);
  background: rgba(180, 35, 24, 0.08);
  color: #b42318;
}

.ctx-stat-del strong {
  color: #8f1a12;
}

.ctx-stat-same {
  border-color: var(--dica-border);
}

.ctx-stat-chg {
  border-color: rgba(198, 144, 0, 0.35);
  background: rgba(198, 144, 0, 0.1);
  color: #9a6700;
}

.ctx-stat-chg strong {
  color: #7a5200;
}

html[data-theme="dark"] .ctx-stat-chg {
  background: rgba(255, 204, 0, 0.1);
  border-color: rgba(255, 204, 0, 0.3);
  color: #ffcc00;
}

html[data-theme="dark"] .ctx-stat-chg strong {
  color: #ffe066;
}

.ctx-stat-sim {
  border-color: var(--dica-action-border, var(--dica-border));
  color: var(--dica-action);
}

.ctx-stat-sim strong {
  color: var(--dica-action);
}

html[data-theme="dark"] .ctx-stat-add {
  background: rgba(110, 231, 168, 0.1);
  border-color: rgba(110, 231, 168, 0.28);
  color: #6ee7a8;
}

html[data-theme="dark"] .ctx-stat-add strong {
  color: #86efac;
}

html[data-theme="dark"] .ctx-stat-del {
  background: rgba(252, 165, 165, 0.1);
  border-color: rgba(252, 165, 165, 0.28);
  color: #fca5a5;
}

html[data-theme="dark"] .ctx-stat-del strong {
  color: #fecaca;
}

.ctx-panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  min-height: 280px;
}

.ctx-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--dica-border);
}

.ctx-pane:last-child {
  border-right: 0;
}

.ctx-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--dica-border);
  background: var(--dica-surface-soft);
}

.ctx-pane-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--dica-ink);
  letter-spacing: 0.01em;
}

.ctx-pane-head-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.ctx-pane-meta {
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--dica-muted);
  white-space: nowrap;
}

.ctx-pane-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

/* Top A/B: always live contenteditable with red/green highlights */
.ctx-textarea.ctx-editor {
  width: 100%;
  min-height: 220px;
  max-height: 420px;
  overflow: auto;
  overscroll-behavior: contain;
  resize: none;
  border: 0;
  border-radius: 0;
  padding: 12px 14px;
  background: var(--dica-surface);
  color: var(--dica-ink);
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  outline: none;
  box-shadow: none;
  tab-size: 2;
  caret-color: var(--dica-action);
}

.ctx-textarea.ctx-editor:focus {
  background: var(--dica-surface);
  box-shadow: inset 0 0 0 2px var(--dica-action-soft);
}

.ctx-textarea.ctx-editor.is-empty:before {
  content: attr(data-placeholder);
  color: var(--dica-muted);
  pointer-events: none;
  float: left;
  height: 0;
  opacity: 0.85;
}

.ctx-textarea.ctx-editor.ctx-drop-active {
  box-shadow: inset 0 0 0 2px var(--dica-action);
  background: var(--dica-action-soft);
}

.ctx-textarea.ctx-editor .ctx-tok-del,
.ctx-textarea.ctx-editor .ctx-tok-ins {
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.ctx-result-wrap {
  border-top: 1px solid var(--dica-border);
  background: var(--dica-surface);
}

.ctx-result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--dica-border);
  background: var(--dica-surface-soft);
}

.ctx-result-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--dica-ink);
}

.ctx-result-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.ctx-nav {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-right: 4px;
  padding: 2px;
  border-radius: 10px;
  border: 1px solid var(--dica-border);
  background: var(--dica-surface);
}

.ctx-nav-label {
  min-width: 5.5em;
  text-align: center;
  font-size: 0.76rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--dica-muted);
  padding: 0 4px;
}

.ctx-nav .ctx-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ctx-diff-focus {
  outline: 2px solid var(--dica-action);
  outline-offset: -2px;
  box-shadow: inset 0 0 0 999px rgba(59, 111, 217, 0.08);
  animation: ctx-focus-pulse 0.9s ease;
}

html[data-theme="dark"] .ctx-diff-focus {
  box-shadow: inset 0 0 0 999px rgba(100, 150, 255, 0.12);
}

@keyframes ctx-focus-pulse {
  0% { outline-width: 3px; }
  100% { outline-width: 2px; }
}

.ctx-diff-unified-wrap {
  min-height: 180px;
}

.ctx-diff-unified-col {
  border-right: 0 !important;
  max-height: 520px;
  overflow: auto;
  overscroll-behavior: contain;
}

.ctx-u-mark {
  flex: none;
  width: 1.25em;
  text-align: center;
  font-weight: 800;
  font-size: 0.85em;
  color: var(--dica-muted);
  user-select: none;
  padding-top: 0.05em;
}

.ctx-u-line.is-insert .ctx-u-mark {
  color: #0f7a3f;
}

.ctx-u-line.is-delete .ctx-u-mark {
  color: #b42318;
}

.ctx-u-line.is-change .ctx-u-mark {
  color: #9a6700;
}

html[data-theme="dark"] .ctx-u-line.is-insert .ctx-u-mark {
  color: #6ee7a8;
}

html[data-theme="dark"] .ctx-u-line.is-delete .ctx-u-mark {
  color: #fca5a5;
}

html[data-theme="dark"] .ctx-u-line.is-change .ctx-u-mark {
  color: #ffcc00;
}

.ctx-legend-hint {
  margin-left: auto;
  font-weight: 500;
  opacity: 0.85;
}

.ctx-diff-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  min-height: 180px;
}

.ctx-diff-col {
  min-width: 0;
  border-right: 1px solid var(--dica-border);
  max-height: 520px;
  overflow: auto;
  overscroll-behavior: contain;
}

.ctx-diff-col:last-child {
  border-right: 0;
}

.ctx-diff-col-head {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 8px 12px;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--dica-muted);
  background: var(--dica-surface-soft);
  border-bottom: 1px solid var(--dica-border);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ctx-diff-body {
  margin: 0;
  padding: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.84rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.ctx-line {
  display: flex;
  align-items: stretch;
  min-height: 1.55em;
  border-left: 3px solid transparent;
}

.ctx-line-num {
  flex: none;
  width: 2.6em;
  padding: 0 6px 0 8px;
  text-align: right;
  color: var(--dica-muted);
  font-size: 0.78em;
  user-select: none;
  opacity: 0.75;
  border-right: 1px solid var(--dica-border);
  background: rgba(0, 0, 0, 0.02);
}

html[data-theme="dark"] .ctx-line-num {
  background: rgba(255, 255, 255, 0.03);
}

.ctx-line-text {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 10px 0 8px;
}

.ctx-line.is-empty .ctx-line-text::after {
  content: " ";
  white-space: pre;
}

.ctx-line.is-equal {
  background: transparent;
}

.ctx-line.is-insert {
  background: rgba(15, 122, 63, 0.1);
  border-left-color: #0f7a3f;
}

.ctx-line.is-delete {
  background: rgba(180, 35, 24, 0.1);
  border-left-color: #b42318;
}

.ctx-line.is-change {
  background: rgba(154, 103, 0, 0.08);
  border-left-color: #c69000;
}

html[data-theme="dark"] .ctx-line.is-insert {
  background: rgba(110, 231, 168, 0.1);
  border-left-color: #6ee7a8;
}

html[data-theme="dark"] .ctx-line.is-delete {
  background: rgba(252, 165, 165, 0.1);
  border-left-color: #fca5a5;
}

html[data-theme="dark"] .ctx-line.is-change {
  background: rgba(255, 204, 0, 0.08);
  border-left-color: #ffcc00;
}

.ctx-tok-ins {
  background: rgba(15, 122, 63, 0.22);
  color: inherit;
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.ctx-tok-del {
  background: rgba(180, 35, 24, 0.2);
  color: inherit;
  border-radius: 3px;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

html[data-theme="dark"] .ctx-tok-ins {
  background: rgba(110, 231, 168, 0.28);
}

html[data-theme="dark"] .ctx-tok-del {
  background: rgba(252, 165, 165, 0.26);
}

.ctx-empty-state {
  padding: 28px 18px;
  text-align: center;
  color: var(--dica-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.ctx-empty-state strong {
  display: block;
  margin-bottom: 4px;
  color: var(--dica-ink);
  font-size: 0.98rem;
}

.ctx-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--dica-border);
  background: var(--dica-surface-soft);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--dica-muted);
}

.ctx-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ctx-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex: none;
}

.ctx-swatch-add {
  background: rgba(15, 122, 63, 0.35);
  border: 1px solid #0f7a3f;
}

.ctx-swatch-del {
  background: rgba(180, 35, 24, 0.3);
  border: 1px solid #b42318;
}

.ctx-swatch-chg {
  background: rgba(198, 144, 0, 0.28);
  border: 1px solid #c69000;
}

html[data-theme="dark"] .ctx-swatch-add {
  background: rgba(110, 231, 168, 0.35);
  border-color: #6ee7a8;
}

html[data-theme="dark"] .ctx-swatch-del {
  background: rgba(252, 165, 165, 0.35);
  border-color: #fca5a5;
}

html[data-theme="dark"] .ctx-swatch-chg {
  background: rgba(255, 204, 0, 0.28);
  border-color: #ffcc00;
}

.ctx-toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(12px);
  z-index: 10050;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--dica-surface-raised, var(--dica-surface));
  color: var(--dica-ink);
  border: 1px solid var(--dica-border);
  box-shadow: 0 10px 28px var(--dica-shadow);
  font-size: 0.88rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.ctx-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.ctx-related {
  margin: 18px 0 8px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--dica-border);
  background: var(--dica-surface-soft);
  font-size: 0.92rem;
  line-height: 1.5;
}

.ctx-related strong {
  color: var(--dica-ink);
}

.ctx-hide-nums .ctx-line-num {
  display: none;
}

/* FAQ: override global .faq/.pergunta (1px left pad + collapsed answers) */
.article .ctx-faq,
.ctx-faq {
  margin: 24px 0 12px;
  padding: 8px 18px 6px;
  background-color: transparent;
  border: 1px solid var(--dica-border);
  border-radius: 12px;
  overflow: hidden;
}

.article .ctx-faq h2,
.ctx-faq h2 {
  margin: 10px 0 4px;
  padding: 0;
  color: var(--dica-ink);
}

.article .ctx-faq .pergunta,
.ctx-faq .pergunta {
  margin: 0;
  padding: 14px 8px 8px 0;
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.4;
  color: var(--dica-ink);
  text-transform: none;
  border-bottom: none;
  cursor: default;
  overflow: visible;
  user-select: text;
}

/* Hide global accordion chevron — answers stay open on this tool page */
.article .ctx-faq .pergunta::after,
.ctx-faq .pergunta::after {
  display: none;
}

.article .ctx-faq .resposta,
.ctx-faq .resposta {
  position: static;
  max-height: none !important;
  overflow: visible;
  margin: 0 0 4px;
  padding: 0 0 16px;
  color: var(--dica-body);
  line-height: 1.55;
  border-bottom: 1px solid var(--dica-border);
  transition: none;
}

.article .ctx-faq .resposta:last-of-type,
.ctx-faq .resposta:last-of-type {
  border-bottom: 0;
  margin-bottom: 4px;
  padding-bottom: 14px;
}

@media screen and (max-width: 760px) {
  .ctx-privacy-full {
    display: none;
  }

  .ctx-privacy-short {
    display: inline;
  }

  .ctx-panes,
  .ctx-diff-grid {
    grid-template-columns: 1fr;
  }

  .ctx-pane {
    border-right: 0;
    border-bottom: 1px solid var(--dica-border);
  }

  .ctx-pane:last-child {
    border-bottom: 0;
  }

  .ctx-diff-col {
    border-right: 0;
    border-bottom: 1px solid var(--dica-border);
    max-height: 360px;
  }

  .ctx-diff-col:last-child {
    border-bottom: 0;
  }

  .ctx-diff-unified-col {
    max-height: 360px;
  }

  .ctx-textarea.ctx-editor {
    min-height: 160px;
    max-height: 280px;
  }

  .ctx-toolbar {
    gap: 6px;
  }

  .ctx-btn {
    padding: 8px 10px;
    font-size: 0.8rem;
  }

  .ctx-legend-hint {
    margin-left: 0;
    width: 100%;
  }

  .ctx-result-actions {
    width: 100%;
  }

  .ctx-nav {
    width: 100%;
    justify-content: space-between;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ctx-btn,
  .ctx-toast {
    transition: none;
  }
}
