:root {
  --rx-primary: #0284c7;
  --rx-primary-hover: #0369a1;
  --rx-bg-card: #ffffff;
  --rx-border: #e2e8f0;
  --rx-text-main: #0f172a;
  --rx-text-muted: #64748b;
  --rx-pill-bg: #f1f5f9;
  --rx-pill-hover: #e2e8f0;
  --rx-result-bg: #f8fafc;
  --rx-match-bg: #fef08a;
  --rx-match-text: #854d0e;
  --rx-badge-ok: #16a34a;
  --rx-badge-err: #dc2626;
}

.rx-tool-container {
  max-width: 880px;
  margin: 0 auto 3rem auto;
  font-family: inherit;
  color: var(--rx-text-main);
}

.rx-editor-card {
  background: var(--rx-bg-card);
  border: 1px solid var(--rx-border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.rx-presets-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rx-border);
}

.rx-presets-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--rx-text-muted);
}

.rx-pill-btn {
  background: var(--rx-pill-bg);
  border: 1px solid var(--rx-border);
  color: var(--rx-text-main);
  border-radius: 9999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.rx-pill-btn:hover {
  background: var(--rx-pill-hover);
  border-color: var(--rx-primary);
}

.rx-pattern-box {
  background: var(--rx-pill-bg);
  border: 1px solid var(--rx-border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.rx-pattern-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.rx-pattern-header label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--rx-text-main);
}

.rx-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--rx-badge-ok);
}

.rx-badge-error {
  color: var(--rx-badge-err);
}

.rx-pattern-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--rx-bg-card);
  border: 1px solid var(--rx-border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
}

.rx-slash {
  font-family: monospace;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--rx-text-muted);
}

.rx-pattern-bar input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--rx-primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1rem;
  font-weight: 700;
  outline: none;
}

.rx-active-flags {
  font-family: monospace;
  font-size: 1rem;
  font-weight: 700;
  color: var(--rx-text-muted);
}

.rx-flags-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.rx-flags-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--rx-text-muted);
}

.rx-flag-check {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--rx-text-main);
  cursor: pointer;
}

.rx-test-field {
  margin-bottom: 1.25rem;
}

.rx-field-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.rx-field-header label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--rx-text-main);
}

.rx-stats-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--rx-primary);
}

.rx-test-field textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--rx-border);
  border-radius: 8px;
  background: var(--rx-bg-card);
  color: var(--rx-text-main);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
  box-sizing: border-box;
  resize: vertical;
}

.rx-test-field textarea:focus {
  outline: none;
  border-color: var(--rx-primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.rx-action-row {
  display: flex;
  gap: 0.75rem;
}

.rx-primary-btn {
  flex: 2;
  background: var(--rx-primary);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.rx-primary-btn:hover {
  background: var(--rx-primary-hover);
}

.rx-secondary-btn,
.rx-tertiary-btn {
  background: var(--rx-pill-bg);
  color: var(--rx-text-main);
  border: 1px solid var(--rx-border);
  border-radius: 8px;
  padding: 0.85rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.rx-secondary-btn:hover,
.rx-tertiary-btn:hover {
  background: var(--rx-pill-hover);
}

.rx-results-card {
  background: var(--rx-result-bg);
  border: 1px solid var(--rx-border);
  border-radius: 12px;
  padding: 1.75rem;
}

.rx-result-section {
  margin-bottom: 1.5rem;
}

.rx-result-section:last-child {
  margin-bottom: 0;
}

.rx-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 0.75rem 0;
  color: var(--rx-text-main);
}

.rx-highlight-box {
  background: var(--rx-bg-card);
  border: 1px solid var(--rx-border);
  border-radius: 8px;
  padding: 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.rx-highlight-box mark {
  background: var(--rx-match-bg);
  color: var(--rx-match-text);
  border-radius: 3px;
  padding: 0.1rem 0.25rem;
  font-weight: 700;
}

.rx-table-wrap {
  overflow-x: auto;
}

.rx-matches-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.rx-matches-table th,
.rx-matches-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--rx-border);
}

.rx-matches-table th {
  background: var(--rx-pill-bg);
  font-weight: 700;
  color: var(--rx-text-muted);
}

.rx-matches-table code {
  font-family: monospace;
  background: var(--rx-pill-bg);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
}

.rx-token-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rx-token-item {
  background: var(--rx-bg-card);
  border: 1px solid var(--rx-border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.rx-token-code {
  font-family: monospace;
  font-weight: 700;
  color: var(--rx-primary);
  min-width: 80px;
}

.rx-token-desc {
  color: var(--rx-text-main);
}

.rx-ad {
  overflow: hidden;
  min-height: 280px;
  margin: 32px 0;
  text-align: center;
}
/* tf:dark-palette — generated by migrate_chrome.py */
/* Neutrals inherit the shared chrome tokens so all tools share one
   ground; brand hues are kept and lightened, never inverted. */
[data-theme="dark"] {
  --rx-primary: #81bcda;
  --rx-primary-hover: #69aed4;
  --rx-bg-card: var(--tf-surface);
  --rx-border: var(--tf-surface);
  --rx-text-main: var(--tf-ink);
  --rx-text-muted: var(--tf-ink-faint);
  --rx-pill-bg: var(--tf-surface);
  --rx-pill-hover: var(--tf-surface);
  --rx-result-bg: var(--tf-surface);
  --rx-match-bg: #dacf81;
  --rx-match-text: #d0995c;
  --rx-badge-ok: #7ad89d;
  --rx-badge-err: #da8181;
}
