/* Stackaris Find & Replace Tool — scoped, responsive, dependency-free */
.fr-tool {
    --fr-primary:      #6d28d9;
    --fr-primary-2:    #0ea5e9;
    --fr-accent:       #f97316;
    --fr-danger:       #dc2626;
    --fr-success:      #059669;
    --fr-warn:         #d97706;
    --fr-bg:           #f2f4fa;
    --fr-bg-soft:      #ffffff;
    --fr-card:         rgba(255, 255, 255, 0.95);
    --fr-input-bg:     #fafcff;
    --fr-output-bg:    #f5f8ff;
    --fr-text:         #111827;
    --fr-muted:        #637083;
    --fr-faint:        #93a1b3;
    --fr-border:       rgba(17, 24, 39, 0.09);
    --fr-shadow:       0 20px 54px rgba(15, 23, 42, 0.1);
    --fr-shadow-soft:  0 8px 28px rgba(15, 23, 42, 0.07);
    --fr-radius:       14px;
    --fr-radius-sm:    8px;
    --fr-font:         Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --fr-mono:         ui-monospace, "Cascadia Code", "Fira Code", Consolas, "Courier New", monospace;
    --fr-mark-bg:      rgba(251, 191, 36, 0.38);
    --fr-mark-current: rgba(249, 115, 22, 0.82);
    background:
        linear-gradient(180deg, rgba(109, 40, 217, 0.06) 0%, transparent 360px),
        var(--fr-bg);
    color: var(--fr-text);
    font-family: var(--fr-font);
    line-height: 1.6;
    margin-left:  calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    min-height: 100vh;
    overflow-x: hidden;
    width: 100vw;
}

.fr-tool[data-theme="dark"] {
    --fr-bg:          #0b0f1e;
    --fr-bg-soft:     #101526;
    --fr-card:        rgba(14, 20, 38, 0.96);
    --fr-input-bg:    rgba(8, 12, 26, 0.97);
    --fr-output-bg:   rgba(10, 14, 28, 0.94);
    --fr-text:        #eef2ff;
    --fr-muted:       #a5b4cb;
    --fr-faint:       #6b7a92;
    --fr-border:      rgba(226, 232, 240, 0.09);
    --fr-shadow:      0 24px 60px rgba(0, 0, 0, 0.44);
    --fr-shadow-soft: 0 8px 28px rgba(0, 0, 0, 0.32);
    --fr-mark-bg:     rgba(251, 191, 36, 0.26);
    --fr-mark-current:rgba(249, 115, 22, 0.72);
}

.fr-tool, .fr-tool *, .fr-tool *::before, .fr-tool *::after { box-sizing: border-box; }
.fr-tool h1, .fr-tool h2, .fr-tool h3, .fr-tool p { margin-top: 0; }

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

/* ─── HERO ─────────────────────────────────────────────────────── */
.fr-hero { padding: 36px 20px 16px; }

.fr-hero__inner {
    margin: 0 auto;
    max-width: 1240px;
    width: calc(100% - 40px);
}

.fr-eyebrow {
    color: var(--fr-primary);
    font-size: 0.7rem;
    font-weight: 850;
    letter-spacing: 0.07em;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.fr-hero h1 {
    color: var(--fr-text);
    font-size: clamp(1.7rem, 4vw, 2.8rem);
    font-weight: 900;
    letter-spacing: -0.01em;
    line-height: 1.1;
    margin-bottom: 10px;
}

.fr-hero p:not(.fr-eyebrow) {
    color: var(--fr-muted);
    font-size: 0.94rem;
    margin-bottom: 0;
    max-width: 680px;
}

/* ─── AD SLOTS ─────────────────────────────────────────────────── */
.fr-ad-slot {
    align-items: center;
    background: var(--fr-card);
    border: 1px solid var(--fr-border);
    border-radius: var(--fr-radius);
    box-shadow: var(--fr-shadow-soft);
    color: var(--fr-faint);
    display: flex;
    gap: 10px;
    justify-content: center;
    min-height: 82px;
    padding: 14px;
    text-align: center;
}

.fr-ad-slot span {
    border: 1px solid var(--fr-border);
    border-radius: 999px;
    font-size: 0.64rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    padding: 4px 9px;
    text-transform: uppercase;
}

.fr-ad-slot strong { color: var(--fr-muted); font-size: 0.88rem; }

.fr-ad-slot--top, .fr-ad-slot--wide {
    margin: 0 auto;
    max-width: 970px;
    width: calc(100% - 40px);
}

.fr-ad-slot--wide { margin-bottom: 16px; }

/* ─── WORKSPACE ─────────────────────────────────────────────────── */
.fr-workspace {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0 auto;
    max-width: 1240px;
    padding: 14px 0 22px;
    width: calc(100% - 40px);
}

/* ─── OPTIONS BAR (TOP) ──────────────────────────────────────────── */
.fr-options-bar {
    background: var(--fr-card);
    border: 1px solid var(--fr-border);
    border-radius: var(--fr-radius);
    box-shadow: var(--fr-shadow-soft);
    display: flex;
    flex-wrap: wrap;
    overflow: hidden;
}

.fr-opt-col {
    border-right: 1px solid var(--fr-border);
    flex: 1 1 auto;
    padding: 14px 18px 16px;
}

.fr-opt-col--last { border-right: 0; }

.fr-opt-label {
    color: var(--fr-muted);
    font-size: 0.63rem;
    font-weight: 850;
    letter-spacing: 0.09em;
    margin-bottom: 9px;
    text-transform: uppercase;
}

.fr-opt-label--spaced { margin-top: 13px; }

.fr-check {
    align-items: center;
    cursor: pointer;
    display: flex;
    gap: 7px;
    padding: 2px 0;
    user-select: none;
}

.fr-check input[type="checkbox"],
.fr-check input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    background: var(--fr-input-bg);
    border: 1.5px solid rgba(100, 116, 139, 0.38);
    cursor: pointer;
    flex-shrink: 0;
    height: 14px;
    position: relative;
    transition: background 0.14s ease, border-color 0.14s ease;
    width: 14px;
}

.fr-check input[type="checkbox"] { border-radius: 4px; }
.fr-check input[type="radio"]    { border-radius: 50%; }
.fr-check input:hover            { border-color: var(--fr-primary); }
.fr-check input:checked          { background: var(--fr-primary); border-color: var(--fr-primary); }

.fr-check input[type="checkbox"]:checked::after {
    border: 2px solid #fff;
    border-left: 0;
    border-top: 0;
    content: "";
    height: 7px;
    left: 3px;
    position: absolute;
    top: 1px;
    transform: rotate(45deg);
    width: 4px;
}

.fr-check input[type="radio"]:checked::after {
    background: #fff;
    border-radius: 50%;
    content: "";
    height: 6px;
    left: 3px;
    position: absolute;
    top: 3px;
    width: 6px;
}

.fr-check input:focus-visible {
    outline: 3px solid rgba(109, 40, 217, 0.28);
    outline-offset: 2px;
}

.fr-check span {
    color: var(--fr-text);
    font-size: 0.83rem;
    line-height: 1.3;
    transition: color 0.12s ease;
}

.fr-check:hover span { color: var(--fr-primary); }

/* ─── MAIN GRID ──────────────────────────────────────────────────── */
.fr-main-grid {
    align-items: start;
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr 288px;
}

/* ─── LEFT COLUMN: Input + Output stacked ───────────────────────── */
.fr-left-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ─── PANELS ─────────────────────────────────────────────────────── */
.fr-panel {
    background: var(--fr-card);
    border: 1px solid var(--fr-border);
    border-radius: var(--fr-radius);
    box-shadow: var(--fr-shadow-soft);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.fr-input-panel:focus-within {
    box-shadow: var(--fr-shadow-soft), 0 0 0 2px rgba(109, 40, 217, 0.16);
}

/* Panel header */
.fr-panel-header {
    align-items: center;
    border-bottom: 1px solid var(--fr-border);
    display: flex;
    flex-shrink: 0;
    gap: 8px;
    justify-content: space-between;
    padding: 11px 16px;
}

.fr-panel-header h2 {
    font-size: 0.95rem;
    font-weight: 850;
    line-height: 1.2;
    margin-bottom: 0;
}

.fr-panel-header__meta .fr-eyebrow { margin-bottom: 2px; }

.fr-panel-header__actions { display: flex; flex-shrink: 0; gap: 6px; }

/* Panel footer */
.fr-panel-footer {
    align-items: center;
    display: flex;
    flex-shrink: 0;
    padding: 8px 16px;
}

.fr-footer-meta {
    color: var(--fr-muted);
    display: flex;
    flex-wrap: wrap;
    font-size: 0.73rem;
    font-weight: 700;
    gap: 3px 5px;
}

.fr-sep { color: var(--fr-faint); user-select: none; }

/* Editor wrap + highlight overlay */
.fr-editor-wrap {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.fr-highlight-layer {
    bottom: 0;
    color: transparent;
    font-family: var(--fr-mono);
    font-size: 0.91rem;
    left: 0;
    line-height: 1.75;
    overflow: hidden;
    padding: 14px 16px;
    pointer-events: none;
    position: absolute;
    right: 0;
    tab-size: 2;
    top: 0;
    white-space: pre-wrap;
    word-break: break-word;
    word-wrap: break-word;
    z-index: 0;
}

.fr-highlight-layer .fr-mark {
    background: var(--fr-mark-bg);
    border-radius: 2px;
    color: transparent;
}

.fr-highlight-layer .fr-mark--current {
    background: var(--fr-mark-current);
    border-radius: 3px;
    outline: 2px solid rgba(249, 115, 22, 0.52);
    outline-offset: 0;
}

/* Textareas */
.fr-editor {
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--fr-border);
    caret-color: var(--fr-text);
    color: var(--fr-text);
    display: block;
    flex: 1 1 auto;
    font-family: var(--fr-mono);
    font-size: 0.91rem;
    line-height: 1.75;
    min-height: 280px;
    padding: 14px 16px;
    position: relative;
    resize: vertical;
    tab-size: 2;
    width: 100%;
    z-index: 1;
}

.fr-editor--output {
    background: var(--fr-output-bg);
    cursor: default;
    min-height: 280px;
    resize: none;
}

.fr-tool[data-theme="dark"] .fr-editor--output {
    color: rgba(167, 210, 255, 0.88);
}

.fr-editor::placeholder { color: var(--fr-faint); font-family: var(--fr-font); font-size: 0.88rem; }
.fr-editor:focus { outline: none; }

/* ─── BUTTONS (panel) ────────────────────────────────────────────── */
.fr-btn {
    align-items: center;
    border: 1px solid var(--fr-border);
    border-radius: var(--fr-radius-sm);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    justify-content: center;
    min-height: 32px;
    padding: 5px 11px;
    transition: background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
    white-space: nowrap;
}

.fr-btn--primary {
    background: linear-gradient(135deg, var(--fr-primary), var(--fr-primary-2));
    border-color: transparent;
    color: #fff;
}

.fr-btn--quiet { background: var(--fr-bg-soft); color: var(--fr-text); }

.fr-btn--danger {
    background: var(--fr-bg-soft);
    border-color: rgba(220, 38, 38, 0.2);
    color: var(--fr-danger);
}

.fr-btn:hover { box-shadow: 0 3px 10px rgba(109, 40, 217, 0.12); transform: translateY(-1px); }
.fr-btn--primary:hover { box-shadow: 0 5px 14px rgba(109, 40, 217, 0.28); }
.fr-btn--danger:hover  { background: rgba(220, 38, 38, 0.06); border-color: rgba(220, 38, 38, 0.28); }

.fr-btn:focus-visible {
    outline: 3px solid rgba(109, 40, 217, 0.28);
    outline-offset: 2px;
}

/* ─── SIDEBAR ─────────────────────────────────────────────────────── */
.fr-sidebar {
    position: sticky;
    top: 16px;
}

/* ─── SEARCH CARD ─────────────────────────────────────────────────── */
.fr-search-card {
    background: var(--fr-card);
    border: 1px solid var(--fr-border);
    border-radius: var(--fr-radius);
    box-shadow: var(--fr-shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
}

/* Card header row */
.fr-sc-head {
    align-items: center;
    background: linear-gradient(135deg, rgba(109, 40, 217, 0.06), rgba(14, 165, 233, 0.04));
    border-bottom: 1px solid var(--fr-border);
    display: flex;
    justify-content: space-between;
    padding: 10px 16px;
}

.fr-sc-head .fr-eyebrow { margin-bottom: 0; }

.fr-sc-head__controls { align-items: center; display: flex; gap: 6px; }

/* Field groups */
.fr-sc-field-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 12px 16px 0;
}

.fr-sc-field-group:last-of-type { padding-bottom: 0; }

.fr-sc-field-label {
    color: var(--fr-muted);
    font-size: 0.63rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Fields */
.fr-field {
    background: var(--fr-input-bg);
    border: 1.5px solid var(--fr-border);
    border-radius: var(--fr-radius-sm);
    color: var(--fr-text);
    display: block;
    font: inherit;
    font-family: var(--fr-mono);
    font-size: 0.87rem;
    min-height: 38px;
    padding: 8px 11px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    width: 100%;
}

.fr-field:focus {
    border-color: var(--fr-primary);
    box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.13);
    outline: none;
}

.fr-field--sm { font-size: 0.82rem; min-height: 32px; padding: 5px 9px; }

/* Match badge + nav counter inline under field */
.fr-match-badge {
    align-self: flex-start;
    background: linear-gradient(135deg, rgba(109, 40, 217, 0.11), rgba(14, 165, 233, 0.09));
    border: 1px solid rgba(109, 40, 217, 0.2);
    border-radius: 999px;
    color: var(--fr-primary);
    font-size: 0.68rem;
    font-weight: 850;
    padding: 3px 9px;
    white-space: nowrap;
}

.fr-match-badge--none {
    background: rgba(148, 163, 184, 0.1);
    border-color: var(--fr-border);
    color: var(--fr-faint);
}

.fr-match-badge--error {
    background: rgba(220, 38, 38, 0.09);
    border-color: rgba(220, 38, 38, 0.24);
    color: var(--fr-danger);
}

.fr-nav-counter {
    color: var(--fr-muted);
    font-size: 0.72rem;
    font-weight: 800;
    min-height: 20px;
    white-space: nowrap;
}

/* Divider */
.fr-sc-divider {
    background: var(--fr-border);
    height: 1px;
    margin: 14px 0 0;
}

/* Sections */
.fr-sc-section { padding: 12px 16px 0; }

.fr-sc-section-label {
    color: var(--fr-muted);
    font-size: 0.61rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
    text-transform: uppercase;
}

/* Nav row: Prev + Next side by side */
.fr-sc-nav-row {
    display: grid;
    gap: 6px;
    grid-template-columns: 1fr 1fr;
}

/* Card buttons */
.fr-sc-btn {
    border-radius: var(--fr-radius-sm);
    cursor: pointer;
    display: block;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    min-height: 36px;
    padding: 8px 12px;
    text-align: center;
    transition: box-shadow 0.16s ease, transform 0.16s ease, opacity 0.14s ease;
    width: 100%;
}

.fr-sc-btn + .fr-sc-btn { margin-top: 6px; }

.fr-sc-btn--nav {
    background: var(--fr-bg-soft);
    border: 1px solid var(--fr-border);
    color: var(--fr-text);
    font-size: 0.8rem;
}

.fr-sc-btn--nav:hover {
    border-color: var(--fr-primary);
    box-shadow: 0 3px 10px rgba(109, 40, 217, 0.14);
    transform: translateY(-1px);
}

.fr-sc-btn--replace {
    background: linear-gradient(135deg, var(--fr-primary), var(--fr-primary-2));
    border: none;
    color: #fff;
    margin-top: 0;
}

.fr-sc-btn--replace:hover {
    box-shadow: 0 5px 16px rgba(109, 40, 217, 0.32);
    transform: translateY(-1px);
}

.fr-sc-btn--replace-all {
    background: linear-gradient(135deg, var(--fr-accent), #ef4444);
    border: none;
    color: #fff;
}

.fr-sc-btn--replace-all:hover {
    box-shadow: 0 5px 16px rgba(249, 115, 22, 0.34);
    transform: translateY(-1px);
}

.fr-sc-btn--undo {
    background: transparent;
    border: 1px solid var(--fr-border);
    color: var(--fr-muted);
}

.fr-sc-btn--undo:hover {
    border-color: var(--fr-warn);
    color: var(--fr-warn);
    transform: translateY(-1px);
}

.fr-sc-btn:active  { transform: scale(0.98) !important; }
.fr-sc-btn:disabled { cursor: default; opacity: 0.36; transform: none !important; }

.fr-sc-btn:focus-visible {
    outline: 3px solid rgba(109, 40, 217, 0.28);
    outline-offset: 2px;
}

/* ─── TOGGLE ROWS ─────────────────────────────────────────────────── */
.fr-toggle-row {
    align-items: center;
    cursor: pointer;
    display: flex;
    gap: 10px;
    padding: 8px 0;
    user-select: none;
}

.fr-toggle-row + .fr-toggle-row {
    border-top: 1px solid var(--fr-border);
}

.fr-toggle-row__label {
    color: var(--fr-text);
    display: block;
    font-size: 0.84rem;
    font-weight: 750;
    line-height: 1.2;
}

.fr-toggle-row__sub {
    color: var(--fr-faint);
    display: block;
    font-size: 0.72rem;
    line-height: 1.3;
    margin-top: 1px;
}

.fr-toggle-row > :first-child  { flex: 1 1 auto; }
.fr-toggle-row__label { display: block; }

.fr-toggle-wrap { flex-shrink: 0; }

.fr-toggle-track {
    background: rgba(148, 163, 184, 0.36);
    border-radius: 999px;
    display: block;
    height: 22px;
    position: relative;
    transition: background 0.2s ease;
    width: 40px;
}

.fr-toggle-track::after {
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
    content: "";
    height: 18px;
    left: 2px;
    position: absolute;
    top: 2px;
    transition: transform 0.2s ease;
    width: 18px;
}

.fr-toggle-row input:checked ~ .fr-toggle-track,
.fr-toggle-label input:checked ~ .fr-toggle-track {
    background: linear-gradient(135deg, var(--fr-primary), var(--fr-primary-2));
}

.fr-toggle-row input:checked ~ .fr-toggle-track::after,
.fr-toggle-label input:checked ~ .fr-toggle-track::after {
    transform: translateX(18px);
}

/* ─── SEARCH CARD STATUS FOOTER ──────────────────────────────────── */
.fr-sc-status {
    align-items: center;
    border-top: 1px solid var(--fr-border);
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    margin-top: 14px;
    padding: 10px 16px;
}

.fr-status-badge {
    color: var(--fr-success);
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
}

.fr-status-badge--warn  { color: var(--fr-warn); }
.fr-status-badge--error { color: var(--fr-danger); }

.fr-time-badge {
    background: rgba(109, 40, 217, 0.08);
    border: 1px solid rgba(109, 40, 217, 0.16);
    border-radius: 999px;
    color: var(--fr-primary);
    font-size: 0.67rem;
    font-weight: 800;
    padding: 3px 8px;
    white-space: nowrap;
}

/* ─── ICON & THEME BUTTONS ───────────────────────────────────────── */
.fr-icon-btn {
    background: transparent;
    border: 1px solid var(--fr-border);
    border-radius: var(--fr-radius-sm);
    color: var(--fr-muted);
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    min-height: 28px;
    min-width: 28px;
    padding: 3px 6px;
    transition: border-color 0.14s ease, color 0.14s ease, transform 0.14s ease;
}

.fr-icon-btn:hover { border-color: var(--fr-primary); color: var(--fr-primary); transform: translateY(-1px); }

.fr-icon-btn:focus-visible {
    outline: 3px solid rgba(109, 40, 217, 0.28);
    outline-offset: 2px;
}

.fr-theme-toggle {
    align-items: center;
    background: transparent;
    border: 1px solid var(--fr-border);
    border-radius: var(--fr-radius-sm);
    color: var(--fr-text);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: 0.74rem;
    font-weight: 800;
    gap: 5px;
    min-height: 28px;
    padding: 3px 9px;
    transition: background 0.14s ease, transform 0.14s ease;
    white-space: nowrap;
}

.fr-theme-toggle:hover { background: rgba(109, 40, 217, 0.06); transform: translateY(-1px); }

.fr-theme-toggle:focus-visible {
    outline: 3px solid rgba(109, 40, 217, 0.28);
    outline-offset: 2px;
}

.fr-theme-toggle__switch {
    background: linear-gradient(135deg, var(--fr-primary), var(--fr-primary-2));
    border-radius: 999px;
    display: inline-block;
    flex-shrink: 0;
    height: 14px;
    position: relative;
    width: 26px;
}

.fr-theme-toggle__switch::after {
    background: #fff;
    border-radius: 50%;
    content: "";
    height: 10px;
    left: 2px;
    position: absolute;
    top: 2px;
    transition: transform 0.2s ease;
    width: 10px;
}

.fr-tool[data-theme="dark"] .fr-theme-toggle__switch::after { transform: translateX(12px); }

/* ─── STATISTICS ROW ─────────────────────────────────────────────── */
.fr-stats-row {
    display: grid;
    gap: 9px;
    grid-template-columns: repeat(8, minmax(0, 1fr));
}

.fr-stat-card {
    background: var(--fr-card);
    border: 1px solid var(--fr-border);
    border-radius: var(--fr-radius-sm);
    box-shadow: var(--fr-shadow-soft);
    min-height: 72px;
    padding: 10px 12px;
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.fr-stat-card:hover {
    border-color: rgba(109, 40, 217, 0.26);
    box-shadow: 0 5px 16px rgba(109, 40, 217, 0.1);
    transform: translateY(-2px);
}

.fr-stat-card span {
    color: var(--fr-muted);
    display: block;
    font-size: 0.6rem;
    font-weight: 850;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.fr-stat-card strong {
    color: var(--fr-text);
    display: block;
    font-size: clamp(0.9rem, 1.7vw, 1.38rem);
    font-weight: 900;
    line-height: 1.05;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fr-stat-card--primary {
    background: linear-gradient(135deg, rgba(109, 40, 217, 0.11), rgba(14, 165, 233, 0.09));
    border-color: rgba(109, 40, 217, 0.17);
}

.fr-tool[data-theme="dark"] .fr-stat-card { background: rgba(255, 255, 255, 0.04); }
.fr-tool[data-theme="dark"] .fr-stat-card--primary {
    background: linear-gradient(135deg, rgba(109, 40, 217, 0.2), rgba(14, 165, 233, 0.12));
}

.fr-stat-card strong.fr-stat--changed { animation: fr-stat-pop 0.28s ease; }

@keyframes fr-stat-pop {
    0%   { color: var(--fr-primary); transform: scale(1.14); }
    100% { transform: scale(1); }
}

/* ─── FULLSCREEN ─────────────────────────────────────────────────── */
.fr-tool[data-fullscreen="true"] .fr-main-grid {
    background: var(--fr-bg);
    bottom: 0;
    left: 0;
    padding: 10px;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 9000;
}

.fr-tool[data-fullscreen="true"] .fr-left-col {
    height: calc(100vh - 20px);
    overflow: hidden;
}

.fr-tool[data-fullscreen="true"] .fr-panel {
    flex: 1 1 50%;
    border-radius: var(--fr-radius-sm);
}

.fr-tool[data-fullscreen="true"] .fr-editor {
    flex: 1 1 auto;
    min-height: unset;
    resize: none;
}

.fr-tool[data-fullscreen="true"] .fr-sidebar {
    height: calc(100vh - 20px);
    overflow-y: auto;
    position: static;
}

/* ─── SEO CONTENT ────────────────────────────────────────────────── */
.fr-content, .fr-faq, .fr-related {
    background: var(--fr-card);
    border: 1px solid var(--fr-border);
    border-radius: var(--fr-radius);
    box-shadow: var(--fr-shadow-soft);
    margin-bottom: 14px;
    margin-left: auto;
    margin-right: auto;
    max-width: 1240px;
    width: calc(100% - 40px);
}

.fr-section-heading {
    border-bottom: 1px solid var(--fr-border);
    padding: 16px 20px;
}

.fr-section-heading h2 { font-size: 1.02rem; font-weight: 850; line-height: 1.25; margin-bottom: 0; }
.fr-section-heading .fr-eyebrow { margin-bottom: 3px; }

.fr-content__grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 16px 20px 20px;
}

.fr-content__grid--wide { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.fr-content article {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--fr-border);
    border-radius: var(--fr-radius-sm);
    padding: 14px 16px;
}

.fr-tool[data-theme="dark"] .fr-content article { background: rgba(255, 255, 255, 0.04); }
.fr-content h3 { font-size: 0.92rem; font-weight: 850; margin-bottom: 7px; }
.fr-content p  { color: var(--fr-muted); font-size: 0.86rem; line-height: 1.65; margin-bottom: 0; }

.fr-content code, .fr-faq code {
    background: rgba(109, 40, 217, 0.08);
    border: 1px solid rgba(109, 40, 217, 0.14);
    border-radius: 4px;
    font-family: var(--fr-mono);
    font-size: 0.82em;
    padding: 1px 4px;
}

.fr-examples-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 16px 20px 20px;
}

.fr-example-card {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--fr-border);
    border-left: 3px solid var(--fr-border);
    border-radius: var(--fr-radius-sm);
    padding: 12px 14px;
}

.fr-example-card--output { border-left-color: var(--fr-primary); }
.fr-tool[data-theme="dark"] .fr-example-card { background: rgba(255, 255, 255, 0.04); }

.fr-example-card__label {
    color: var(--fr-muted);
    display: block;
    font-size: 0.67rem;
    font-weight: 850;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.fr-example-card__text {
    background: var(--fr-input-bg);
    border: 1px solid var(--fr-border);
    border-radius: 6px;
    color: var(--fr-text);
    display: block;
    font-family: var(--fr-mono);
    font-size: 0.83rem;
    line-height: 1.6;
    padding: 8px 10px;
    white-space: pre-wrap;
    word-break: break-all;
}

/* FAQ */
.fr-faq details { border-bottom: 1px solid var(--fr-border); padding: 0 20px; }
.fr-faq details:last-child { border-bottom: 0; }

.fr-faq summary {
    color: var(--fr-text);
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 850;
    list-style: none;
    padding: 14px 26px 14px 0;
    position: relative;
}

.fr-faq summary::after {
    color: var(--fr-primary);
    content: "+";
    font-size: 1.1rem;
    font-weight: 400;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.18s ease;
}

.fr-faq details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.fr-faq summary::-webkit-details-marker { display: none; }

.fr-faq summary:focus-visible {
    outline: 3px solid rgba(109, 40, 217, 0.28);
    outline-offset: 3px;
}

.fr-faq details p { color: var(--fr-muted); font-size: 0.88rem; line-height: 1.7; margin-bottom: 14px; }

/* Related */
.fr-related__grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    padding: 16px 20px 20px;
}

.fr-related a {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--fr-border);
    border-radius: var(--fr-radius-sm);
    color: var(--fr-primary);
    display: block;
    font-size: 0.82rem;
    font-weight: 850;
    padding: 11px 12px;
    text-align: center;
    text-decoration: none;
    transition: background 0.14s ease, transform 0.14s ease;
}

.fr-tool[data-theme="dark"] .fr-related a { background: rgba(255, 255, 255, 0.04); }
.fr-related a:hover { background: rgba(109, 40, 217, 0.09); transform: translateY(-2px); }

.fr-related a:focus-visible {
    outline: 3px solid rgba(109, 40, 217, 0.28);
    outline-offset: 2px;
}

/* ─── RESPONSIVE: TABLET (≤ 1099px) ─────────────────────────────── */
@media (max-width: 1099px) {
    .fr-main-grid { grid-template-columns: 1fr 264px; }
    .fr-stats-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .fr-related__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ─── RESPONSIVE: SMALL TABLET (≤ 860px) ────────────────────────── */
@media (max-width: 860px) {
    .fr-main-grid { grid-template-columns: 1fr; }

    .fr-sidebar {
        position: static;
        order: -1; /* Search card above editors on tablet */
    }

    .fr-search-card { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }

    .fr-sc-head { grid-column: 1 / -1; }

    .fr-options-bar {
        background: var(--fr-border);
        display: grid;
        gap: 1px;
        grid-template-columns: 1fr 1fr;
    }

    .fr-opt-col { background: var(--fr-card); border-right: 0; }
    .fr-opt-col--last { grid-column: 1 / -1; }
}

/* ─── RESPONSIVE: MOBILE (≤ 639px) ──────────────────────────────── */
@media (max-width: 639px) {
    .fr-hero { padding-top: 24px; }

    .fr-workspace,
    .fr-content, .fr-faq, .fr-related,
    .fr-ad-slot--top, .fr-ad-slot--wide { width: calc(100% - 24px); }

    .fr-search-card { display: flex; }

    .fr-stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .fr-options-bar { grid-template-columns: 1fr; }
    .fr-opt-col--last { grid-column: auto; }

    .fr-panel-header { align-items: flex-start; flex-direction: column; gap: 8px; }
    .fr-panel-header__actions { width: 100%; }
    .fr-btn { flex: 1 1 auto; }

    .fr-sc-nav-row { grid-template-columns: 1fr 1fr; }

    .fr-editor { font-size: 0.88rem; min-height: 220px; }
    .fr-editor--output { min-height: 180px; }

    .fr-content__grid, .fr-content__grid--wide { grid-template-columns: 1fr; }
    .fr-examples-grid { grid-template-columns: 1fr; }
    .fr-related__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .fr-section-heading, .fr-faq details { padding-left: 16px; padding-right: 16px; }
    .fr-content__grid, .fr-examples-grid, .fr-related__grid { padding: 12px 16px 16px; }
}

/* ─── REDUCED MOTION ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .fr-tool *, .fr-tool *::before, .fr-tool *::after {
        animation-duration: 0.01ms !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
