.rt-card { padding: 28px; }
.rt-title-bar { background: linear-gradient(135deg, var(--site-dark) 0%, var(--site-dark-2) 100%); border-radius: 10px 10px 0 0; padding: 18px 24px; margin: -28px -28px 24px; }
.rt-title-bar h1 { color: #fff; margin: 0; font-size: 1.4em; text-align: center; }

.rt-body { display: flex; flex-direction: column; gap: 20px; }
.rt-field label, .rt-pattern-field label { display: block; font-weight: 600; margin-bottom: 8px; font-size: .92em; }

/* ===== Pattern input ===== */
.rt-pattern-wrap { display: flex; align-items: center; gap: 4px; border: 1px solid #ddd; border-radius: 8px; padding: 8px 12px; background: #fafbfc; transition: border-color .15s ease, box-shadow .15s ease; }
.rt-pattern-wrap:focus-within { border-color: var(--site-light); box-shadow: 0 0 0 3px rgba(20, 184, 166, .12); }
.rt-slash { color: #9aa0aa; font-family: "Courier New", monospace; font-size: 1.15em; font-weight: 700; flex-shrink: 0; }
.rt-pattern-wrap input[type="text"] { flex: 1; border: none; outline: none; background: transparent; font-family: "Courier New", monospace; font-size: 1em; min-width: 0; }
.rt-flags-display { font-family: "Courier New", monospace; font-size: .95em; font-weight: 700; color: var(--site-accent); flex-shrink: 0; min-width: 1.2em; text-align: left; }

/* ===== Flags checkboxes ===== */
.rt-flags-row { display: flex; flex-wrap: wrap; gap: 10px; }
.rt-flag { display: flex; align-items: center; gap: 6px; border: 1px solid #eee; border-radius: 20px; padding: 6px 14px 6px 10px; cursor: pointer; font-size: .88em; background: #f7f8fa; transition: background .15s ease, border-color .15s ease; user-select: none; }
.rt-flag:hover { background: #eef0f3; }
.rt-flag input[type="checkbox"] { accent-color: var(--site-dark); width: 15px; height: 15px; margin: 0; cursor: pointer; }
.rt-flag span { font-family: "Courier New", monospace; font-weight: 700; color: var(--site-dark); }
.rt-flag small { color: #6b7280; }
.rt-flag:has(input:checked) { background: #f0fdfa; border-color: var(--site-light); }

/* ===== Preset patterns ===== */
.rt-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rt-presets-label { font-size: .85em; color: #6b7280; font-weight: 600; margin-right: 2px; }
.rt-preset-btn { background: none; border: 1px solid #ddd; border-radius: 20px; padding: 6px 14px; font-size: .82em; font-weight: 600; color: var(--site-dark); cursor: pointer; transition: background .15s ease, border-color .15s ease; }
.rt-preset-btn:hover { background: #f0fdfa; border-color: var(--site-light); }
.rt-preset-btn:active { transform: translateY(1px); }

/* ===== Error banner ===== */
.rt-error { background: var(--site-danger-bg); border: 1px solid var(--site-danger-border); color: var(--site-danger); border-radius: 8px; padding: 10px 14px; font-size: .88em; font-family: "Courier New", monospace; }
.rt-error.hide { display: none; }

/* ===== Test string textarea ===== */
#rtTestString { width: 100%; border: 1px solid #ddd; border-radius: 8px; padding: 12px 14px; font-family: "Courier New", monospace; font-size: .92em; line-height: 1.6; resize: vertical; box-sizing: border-box; }
#rtTestString:focus { outline: none; border-color: var(--site-light); box-shadow: 0 0 0 3px rgba(20, 184, 166, .12); }

/* ===== Live preview ===== */
.rt-preview-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.rt-preview-label-row label { margin-bottom: 0; }
.rt-match-count { font-size: .82em; font-weight: 700; color: var(--site-accent); background: #fff7e6; border-radius: 20px; padding: 3px 12px; }
.rt-preview { border: 1px solid #eee; border-radius: 8px; padding: 12px 14px; font-family: "Courier New", monospace; font-size: .92em; line-height: 1.6; white-space: pre-wrap; word-break: break-word; background: #fafbfc; min-height: 60px; max-height: 320px; overflow-y: auto; }
.rt-preview mark { background: #fde68a; color: #23272f; border-radius: 3px; padding: 0 1px; box-shadow: 0 0 0 1px #f59e0b inset; }
.rt-preview mark.rt-mark-alt { background: var(--site-success-border); box-shadow: 0 0 0 1px var(--site-success) inset; }

/* ===== Match list ===== */
.rt-match-list { display: flex; flex-direction: column; gap: 10px; }
.rt-empty { color: #6b7280; font-size: .9em; margin: 0; padding: 10px 0; }
.rt-match { border: 1px solid #eee; border-radius: 8px; padding: 12px 14px; background: #f7f8fa; }
.rt-match-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 6px; }
.rt-match-index { font-size: .78em; font-weight: 700; color: #fff; background: var(--site-dark); border-radius: 20px; padding: 2px 10px; }
.rt-match-pos { font-size: .8em; color: #6b7280; }
.rt-match-text { font-family: "Courier New", monospace; font-size: .92em; background: #fde68a; border-radius: 4px; padding: 2px 8px; word-break: break-all; }
.rt-match-groups { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.rt-group-row { font-size: .84em; display: flex; gap: 8px; flex-wrap: wrap; }
.rt-group-label { font-weight: 700; color: var(--site-dark); flex-shrink: 0; }
.rt-group-value { font-family: "Courier New", monospace; color: #3d4148; word-break: break-all; }
.rt-group-value.rt-group-empty { color: #9aa0aa; font-style: italic; }

/* ===== Bulk mode (per-line results + extraction output) ===== */
.rt-bulk-toggle { margin-left: auto; background: #f0fdfa; border-color: var(--site-light); }
.rt-bulk-toggle span { color: var(--site-dark); }

.rt-bulk-table-wrap { border: 1px solid #eee; border-radius: 8px; max-height: 420px; overflow: auto; }
table.rt-bulk-table { width: 100%; border-collapse: collapse; font-size: .86em; }
table.rt-bulk-table th { position: sticky; top: 0; background: #f7f8fa; text-align: left; padding: 8px 12px; font-weight: 700; color: #374151; border-bottom: 1px solid #eee; z-index: 1; }
table.rt-bulk-table td { padding: 7px 12px; border-bottom: 1px solid #f0f1f3; vertical-align: top; }
table.rt-bulk-table tr:last-child td { border-bottom: none; }
table.rt-bulk-table td:first-child { color: #6b7280; font-family: "Courier New", monospace; white-space: nowrap; }
table.rt-bulk-table td:nth-child(2) { font-weight: 700; color: var(--site-accent); text-align: center; }
.rt-bulk-cell { font-family: "Courier New", monospace; word-break: break-all; }
.rt-bulk-cell mark { background: #fde68a; color: #23272f; border-radius: 3px; padding: 0 4px; margin-right: 3px; display: inline-block; }
.rt-bulk-truncate-note { margin: 10px 12px; font-size: .82em; color: #6b7280; }

#rtExtracted { width: 100%; border: 1px solid #ddd; border-radius: 8px; padding: 12px 14px; font-family: "Courier New", monospace; font-size: .88em; line-height: 1.6; resize: vertical; box-sizing: border-box; background: #fafbfc; color: #23272f; }
#rtExtracted:focus { outline: none; border-color: var(--site-light); }
.rt-preview-label-row label small { display: block; font-weight: 400; color: #6b7280; margin-top: 2px; }

.rt-copy-btn { background: none; border: 1px solid var(--site-light); border-radius: 20px; padding: 5px 14px; font-size: .8em; font-weight: 600; color: var(--site-dark); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; }
.rt-copy-btn:hover { background: #f0fdfa; }
.rt-copy-btn.rt-copied { background: var(--site-success-bg); border-color: #86efac; color: var(--site-success); }

@media (max-width: 600px) {
    .rt-title-bar { margin: -20px -20px 20px; padding: 16px 18px; }
    .rt-flags-row { gap: 8px; }
    .rt-flag { padding: 5px 12px 5px 8px; }
}
