
        :root {
            --bg:       #080b0f;
            --bg2:      #0d1117;
            --bg3:      #111820;
            --bg4:      #161e28;
            --neon:     #00ff88;
            --neon2:    #00ccff;
            --neon3:    #ff006e;
            --neon4:    #ffcc00;
            --neon-dim: #00ff8833;
            --border:   rgba(0,255,136,0.12);
            --border-h: rgba(0,255,136,0.4);
            --text:     #c8d8e8;
            --muted:    #3a4a5a;
            --mono:     'Fira Code', monospace;
            --display:  'Rajdhani', sans-serif;

            /* match highlight colors */
            --match-bg:  rgba(0,255,136,0.2);
            --match-bdr: rgba(0,255,136,0.6);
            --g1: rgba(0,204,255,0.25);
            --g2: rgba(255,204,0,0.25);
            --g3: rgba(255,0,110,0.2);
            --g4: rgba(180,100,255,0.25);
        }

        * { margin:0; padding:0; box-sizing:border-box; }

        body {
            background: var(--bg);
            color: var(--text);
            font-family: var(--mono);
            min-height: 100vh;   
            overflow: auto;
            display: flex;
            flex-direction: column;
        }

        /* ── NOISE TEXTURE ── */
        body::before {
            content:'';
            position:fixed;
            inset:0;
            background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
            pointer-events:none;
            z-index:0;
            opacity:0.4;
        }

        /* ── HEADER ── */
        header {
            position: relative;
            z-index: 10;
            background: var(--bg2);
            border-bottom: 1px solid var(--border);
            padding: 0 20px;
            height: 86px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-shrink: 0;
        }

        .brand {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .brand-icon {
            width: 32px;
            height: 32px;
            background: linear-gradient(135deg, var(--neon), var(--neon2));
            border-radius: 6px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 16px;
            flex-shrink: 0;
            
        }

        .brand-name {
            font-family: var(--display);
            font-size: 22px;
            font-weight: 700;
            letter-spacing: 2px;
            color: white;
        }

        .brand-name span { color: var(--neon); }

.brand-sub {
    font-size: 10px;
    color: var(--muted);
    letter-spacing: 2px;
    margin-top: 1px;
    opacity: 0.8;
}

.brand-sub a {
    color: #ffffff;
    text-decoration: none;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.brand-sub a:hover {
    opacity: 1;
    color: var(--neon);
}

.brand-sub a:not(:last-child)::after {
    content: ' |';
    opacity: 0.3;
    color: var(--muted);
}

        .header-right {
            display: flex;
            align-items: center;
            gap: 16px;
        }

        .match-counter {
            font-size: 12px;
            font-family: var(--mono);
            padding: 5px 14px;
            border-radius: 3px;
            background: var(--neon-dim);
            border: 1px solid var(--border-h);
            color: var(--neon);
            letter-spacing: 1px;
            transition: all 0.2s;
            min-width: 120px;
            text-align: center;
        }

        .match-counter.error {
            background: rgba(255,0,110,0.1);
            border-color: rgba(255,0,110,0.4);
            color: var(--neon3);
        }

        .match-counter.zero {
            background: rgba(255,204,0,0.08);
            border-color: rgba(255,204,0,0.3);
            color: var(--neon4);
        }

        /* ── REGEX INPUT BAR ── */
        .regex-bar {
            position: relative;
            z-index: 10;
            background: var(--bg3);
            border-bottom: 1px solid var(--border);
            padding: 12px 20px;
            display: flex;
            align-items: center;
            gap: 12px;
            flex-shrink: 0;
        }

        .regex-delimiter {
            font-family: var(--mono);
            font-size: 24px;
            color: var(--neon);
            opacity: 0.5;
            user-select: none;
            flex-shrink: 0;
        }

        .regex-input-wrap {
            flex: 1;
            position: relative;
        }

        .regex-input {
            width: 100%;
            background: var(--bg);
            border: 1px solid var(--border-h);
            border-radius: 4px;
            padding: 10px 16px;
            font-family: var(--mono);
            font-size: 18px;
            font-weight: 500;
            color: var(--neon);
            outline: none;
            letter-spacing: 0.5px;
            transition: all 0.2s;
            caret-color: var(--neon);
        }

        .regex-input:focus {
            box-shadow: 0 0 0 2px rgba(0,255,136,0.2), 0 0 30px rgba(0,255,136,0.05);
        }

        .regex-input.invalid {
            border-color: var(--neon3);
            color: var(--neon3);
            box-shadow: 0 0 0 2px rgba(255,0,110,0.2);
        }

        .flags-wrap {
            display: flex;
            gap: 6px;
            flex-shrink: 0;
        }

        .flag-btn {
            font-family: var(--mono);
            font-size: 13px;
            font-weight: 600;
            width: 32px;
            height: 32px;
            border-radius: 4px;
            border: 1px solid var(--border);
            background: var(--bg);
            color: var(--muted);
            cursor: pointer;
            transition: all 0.15s;
            display: flex;
            align-items: center;
            justify-content: center;
            letter-spacing: 0;
        }

        .flag-btn:hover { border-color: var(--border-h); color: var(--text); }

        .flag-btn.on {
            background: var(--neon-dim);
            border-color: var(--border-h);
            color: var(--neon);
            text-shadow: 0 0 8px rgba(0,255,136,0.5);
        }

        .mode-btns {
            display: flex;
            gap: 4px;
            flex-shrink: 0;
        }

        .mode-btn {
            font-family: var(--display);
            font-size: 12px;
            font-weight: 600;
            padding: 6px 14px;
            border-radius: 3px;
            border: 1px solid var(--border);
            background: transparent;
            color: var(--muted);
            cursor: pointer;
            letter-spacing: 1px;
            transition: all 0.15s;
        }

        .mode-btn.active {
            background: var(--neon-dim);
            border-color: var(--border-h);
            color: var(--neon);
        }

        .mode-btn:hover:not(.active) {
            color: var(--text);
            border-color: rgba(0,255,136,0.25);
        }

        /* ── REPLACE INPUT ── */
        .replace-bar {
            position: relative;
            z-index: 10;
            background: var(--bg3);
            border-bottom: 1px solid var(--border);
            padding: 8px 20px;
            display: flex;
            align-items: center;
            gap: 12px;
            flex-shrink: 0;
            display: none;
        }

        .replace-bar.visible { display: flex; }

        .replace-label {
            font-size: 11px;
            color: var(--muted);
            letter-spacing: 2px;
            flex-shrink: 0;
            width: 80px;
        }

        .replace-input {
            flex: 1;
            background: var(--bg);
            border: 1px solid rgba(255,204,0,0.3);
            border-radius: 4px;
            padding: 8px 14px;
            font-family: var(--mono);
            font-size: 15px;
            color: var(--neon4);
            outline: none;
            transition: all 0.2s;
            caret-color: var(--neon4);
        }

        .replace-input:focus {
            box-shadow: 0 0 0 2px rgba(255,204,0,0.15);
            border-color: rgba(255,204,0,0.5);
        }

        /* ── MAIN LAYOUT ── */
        .main {
            display: grid;
            grid-template-columns: 1fr 340px;
            height: 75vh; 
            position: relative;
            z-index: 1;
        }

        @media (max-width: 900px) {
            .main { grid-template-columns: 1fr; height: auto; min-height: 500px; }
            .sidebar { display: none; }
            body { overflow: auto; }
        }

        /* ── LEFT PANEL ── */
        .left-panel {
            display: flex;
            flex-direction: column;
            border-right: 1px solid var(--border);
            overflow: hidden;
        }

        .panel-header {
            padding: 10px 16px;
            background: var(--bg2);
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-shrink: 0;
        }

        .panel-label {
            font-family: var(--display);
            font-size: 11px;
            letter-spacing: 2px;
            color: var(--muted);
            text-transform: uppercase;
        }

        .panel-actions {
            display: flex;
            gap: 8px;
        }

        .mini-btn {
            font-family: var(--mono);
            font-size: 10px;
            padding: 3px 10px;
            border-radius: 2px;
            border: 1px solid var(--border);
            background: transparent;
            color: var(--muted);
            cursor: pointer;
            letter-spacing: 1px;
            transition: all 0.15s;
        }

        .mini-btn:hover {
            color: var(--neon);
            border-color: var(--border-h);
        }

        /* ── TEST TEXT AREA ── */
        .text-container {
            flex: 1;
            position: relative;
            overflow: hidden;
        }

        .text-highlight-layer {
            position: absolute;
            inset: 0;
            padding: 16px;
            font-family: var(--mono);
            font-size: 14px;
            line-height: 1.7;
            white-space: pre-wrap;
            word-break: break-all;
            pointer-events: none;
            overflow-y: auto;
            color: transparent;
            z-index: 1;
        }

        .text-input {
            position: absolute;
            inset: 0;
            padding: 16px;
            font-family: var(--mono);
            font-size: 14px;
            line-height: 1.7;
            background: transparent;
            border: none;
            outline: none;
            resize: none;
            color: var(--text);
            z-index: 2;
            caret-color: var(--neon2);
            white-space: pre-wrap;
            word-break: break-all;
            overflow-y: auto;
        }

        /* highlight spans */
        .hl-match {
            background: var(--match-bg);
            border-bottom: 2px solid var(--neon);
            border-radius: 2px;
        }

        .hl-match.current {
            background: rgba(0,255,136,0.4);
            border-bottom-color: #fff;
        }

        .hl-g1 { background: var(--g1); border-bottom: 1px dashed var(--neon2); }
        .hl-g2 { background: var(--g2); border-bottom: 1px dashed var(--neon4); }
        .hl-g3 { background: var(--g3); border-bottom: 1px dashed var(--neon3); }
        .hl-g4 { background: var(--g4); border-bottom: 1px dashed #b464ff; }

        /* ── REPLACE RESULT ── */
        .replace-result {
            flex: 1;
            padding: 16px;
            font-family: var(--mono);
            font-size: 14px;
            line-height: 1.7;
            overflow-y: auto;
            background: rgba(255,204,0,0.02);
            border-top: 1px solid rgba(255,204,0,0.15);
            color: var(--neon4);
            white-space: pre-wrap;
            word-break: break-all;
            display: none;
        }

        .replace-result.visible { display: block; }

        /* ── BOTTOM MATCHES ── */
        .matches-panel {
            flex-shrink: 0;
            max-height: 200px;
            overflow-y: auto;
            border-top: 1px solid var(--border);
            background: var(--bg2);
        }

        .matches-panel.hidden { display: none; }

        .matches-header {
            padding: 8px 16px;
            display: flex;
            align-items: center;
            gap: 10px;
            border-bottom: 1px solid var(--border);
            position: sticky;
            top: 0;
            background: var(--bg2);
            z-index: 5;
        }

        .matches-title {
            font-family: var(--display);
            font-size: 11px;
            letter-spacing: 2px;
            color: var(--muted);
        }

        .match-list {
            padding: 8px;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .match-item {
            display: flex;
            align-items: baseline;
            gap: 10px;
            padding: 6px 10px;
            border-radius: 3px;
            border: 1px solid transparent;
            cursor: pointer;
            transition: all 0.15s;
            font-size: 13px;
        }

        .match-item:hover {
            background: var(--neon-dim);
            border-color: var(--border);
        }

        .match-idx {
            font-size: 10px;
            color: var(--muted);
            min-width: 24px;
        }

        .match-val {
            color: var(--neon);
            font-weight: 600;
            flex: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .match-pos {
            font-size: 10px;
            color: var(--muted);
            flex-shrink: 0;
        }

        .match-groups {
            display: flex;
            gap: 6px;
            flex-wrap: wrap;
            margin-top: 2px;
            margin-left: 34px;
        }

        .group-chip {
            font-size: 11px;
            padding: 1px 8px;
            border-radius: 2px;
            font-family: var(--mono);
        }

        .gc-1 { background: var(--g1); color: var(--neon2); border: 1px solid rgba(0,204,255,0.3); }
        .gc-2 { background: var(--g2); color: var(--neon4); border: 1px solid rgba(255,204,0,0.3); }
        .gc-3 { background: var(--g3); color: var(--neon3); border: 1px solid rgba(255,0,110,0.3); }
        .gc-4 { background: var(--g4); color: #c080ff; border: 1px solid rgba(180,100,255,0.3); }

        .empty-val { color: var(--muted); }
        .match-item-body { width: 100%; }
        .match-item-row { display: flex; align-items: center; gap: 10px; }

        /* Offscreen helper for execCommand('copy') fallback */
        .offscreen-copy { position: fixed; top: -9999px; left: -9999px; opacity: 0; }

        /* ── SIDEBAR ── */
        .sidebar {
            display: flex;
            flex-direction: column;
            overflow: hidden;
            background: var(--bg2);
        }

        .sidebar-tabs {
            display: flex;
            border-bottom: 1px solid var(--border);
            flex-shrink: 0;
        }

        .stab {
            flex: 1;
            padding: 10px 4px;
            font-family: var(--display);
            font-size: 11px;
            letter-spacing: 1px;
            text-align: center;
            cursor: pointer;
            color: var(--muted);
            border: none;
            background: transparent;
            border-bottom: 2px solid transparent;
            transition: all 0.15s;
        }

        .stab.active {
            color: var(--neon);
            border-bottom-color: var(--neon);
            background: rgba(0,255,136,0.03);
        }

        .stab:hover:not(.active) { color: var(--text); }

        .stab-content { display: none; overflow-y: auto; flex: 1; }
        .stab-content.active { display: block; }

        /* ── EXPLANATION ── */
        .explanation {
            padding: 12px;
        }

        .exp-node {
            display: flex;
            align-items: flex-start;
            gap: 8px;
            padding: 8px 10px;
            margin-bottom: 4px;
            border-radius: 3px;
            border-left: 3px solid transparent;
            font-size: 12px;
            background: var(--bg3);
            transition: all 0.15s;
        }

        .exp-node:hover { border-left-color: var(--neon); background: var(--bg4); }

        .exp-token {
            font-family: var(--mono);
            font-size: 13px;
            font-weight: 600;
            color: var(--neon);
            min-width: 50px;
            flex-shrink: 0;
        }

        .exp-desc {
            color: var(--text);
            font-size: 11px;
            line-height: 1.5;
        }

        .exp-empty {
            padding: 20px;
            text-align: center;
            color: var(--muted);
            font-size: 12px;
        }

        /* ── PRESETS ── */
        .presets-list {
            padding: 8px;
        }

        .preset-item {
            padding: 10px 12px;
            border-radius: 3px;
            border: 1px solid var(--border);
            margin-bottom: 6px;
            cursor: pointer;
            transition: all 0.15s;
            background: var(--bg3);
        }

        .preset-item:hover {
            border-color: var(--border-h);
            background: var(--bg4);
            transform: translateX(3px);
        }

        .preset-name {
            font-family: var(--display);
            font-size: 13px;
            font-weight: 600;
            color: var(--fc, var(--text));
            margin-bottom: 4px;
        }

        .preset-empty {
            padding: 16px;
            color: var(--muted);
            font-size: 12px;
        }

        .preset-regex {
            font-family: var(--mono);
            font-size: 11px;
            color: var(--neon);
            margin-bottom: 3px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .preset-desc {
            font-size: 10px;
            color: var(--muted);
            letter-spacing: 0.5px;
        }

        /* ── CHEAT SHEET ── */
        .cheat-list {
            padding: 8px;
        }

        .cheat-section-title {
            font-family: var(--display);
            font-size: 10px;
            letter-spacing: 2px;
            color: var(--neon);
            padding: 8px 4px 4px;
            border-bottom: 1px solid var(--border);
            margin-bottom: 6px;
        }

        .cheat-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 5px 6px;
            border-radius: 2px;
            font-size: 12px;
            transition: background 0.1s;
            cursor: pointer;
        }

        .cheat-item:hover { background: var(--bg4); }

        .cheat-token {
            font-family: var(--mono);
            font-size: 12px;
            font-weight: 600;
            color: var(--neon2);
            min-width: 50px;
            flex-shrink: 0;
        }

        .cheat-desc { color: var(--muted); font-size: 11px; }

        /* ── FLAVOR BAR ── */
        .flavor-bar {
            background: var(--bg3); border-bottom: 1px solid var(--border);
            padding: 8px 16px; display: flex; gap: 6px;
            overflow-x: auto; flex-shrink: 0; position: relative; z-index: 10;
        }
        .flavor-bar::-webkit-scrollbar { height: 3px; }
        .flavor-btn {
            display: flex; align-items: center; gap: 6px;
            padding: 5px 12px; border-radius: 3px;
            border: 1px solid var(--border); background: transparent;
            cursor: pointer; white-space: nowrap; transition: all 0.15s; flex-shrink: 0;
        }
        .flavor-icon { font-size: 14px; }
        .flavor-label { font-family: var(--display); font-size: 10px; letter-spacing: 1px; color: var(--muted); }
        .flavor-btn:hover { border-color: rgba(255,255,255,0.25); }
        .flavor-btn:hover .flavor-label { color: var(--text); }
        .flavor-btn.active {
            border-color: var(--fc, #00ff88);
            background: color-mix(in srgb, var(--fc,#00ff88) 10%, transparent);
            box-shadow: 0 0 10px color-mix(in srgb, var(--fc,#00ff88) 20%, transparent);
        }
        .flavor-btn.active .flavor-label { color: var(--fc, #00ff88); font-weight: 700; }
        /* Per-flavor accent colors (drives --fc for any descendant) */
        [data-flavor="javascript"] { --fc: #f7df1e; }
        [data-flavor="python"]     { --fc: #3572a5; }
        [data-flavor="php"]       { --fc: #8892be; }
        [data-flavor="apache"]    { --fc: #d22128; }
        [data-flavor="nginx"]     { --fc: #009900; }
        [data-flavor="fail2ban"]  { --fc: #ff4444; }
        [data-flavor="mysql"]     { --fc: #00758f; }
        [data-flavor="grep"]      { --fc: #89e051; }
        /* HOST replace note */
        .host-replace-note {
            display: none; align-items: center; gap: 8px;
            background: rgba(255,68,68,0.07); border-bottom: 1px solid rgba(255,68,68,0.18);
            padding: 5px 16px; font-size: 11px; color: #ff8888;
            font-family: var(--mono); flex-shrink: 0; position: relative; z-index: 10;
        }
        .host-replace-note.visible { display: flex; }
        /* ── FLAVOR TAB CONTENT ── */
        .flavor-note { padding: 12px; }
        .flavor-note-header {
            display: flex; align-items: center; justify-content: space-between;
            margin-bottom: 8px; font-family: var(--display); font-size: 13px; font-weight: 700;
        }
        .flavor-note-badge {
            font-size: 9px; padding: 2px 7px; border-radius: 2px; border: 1px solid;
            font-family: var(--mono); letter-spacing: 1px;
            color: var(--fc, var(--muted));
        }
        .flavor-note-icon { font-size: 16px; color: var(--fc, var(--text)); }
        .flavor-note-text {
            font-size: 11px; color: var(--muted); line-height: 1.6; margin-bottom: 10px;
            border-bottom: 1px solid var(--border); padding-bottom: 10px;
        }
        .flavor-host-pill {
            background: rgba(255,68,68,0.08); border: 1px solid rgba(255,68,68,0.2);
            border-radius: 3px; padding: 6px 10px; font-size: 11px; color: #ff8888;
            margin-bottom: 10px; font-family: var(--mono);
        }
        .flavor-diff-title {
            font-size: 10px; letter-spacing: 2px; color: var(--muted); margin-bottom: 6px; margin-top: 4px;
        }
        .flavor-diff-item {
            display: flex; align-items: flex-start; gap: 8px;
            padding: 6px 8px; margin-bottom: 3px;
            background: var(--bg3); border-radius: 3px; font-size: 11px;
        }
        .flavor-diff-token {
            font-family: var(--mono); font-size: 10px; font-weight: 700;
            min-width: 80px; max-width: 140px; flex-shrink: 0; word-break: break-all;
            color: var(--fc, var(--text));
        }
        .flavor-diff-desc { color: var(--muted); line-height: 1.5; font-size: 11px; }
        .flavor-presets-label {
            padding: 0 12px 6px; font-size: 10px; letter-spacing: 2px; color: var(--muted);
        }

        /* ── SCROLLBARS ── */
        ::-webkit-scrollbar { width: 5px; height: 5px; }
        ::-webkit-scrollbar-track { background: var(--bg); }
        ::-webkit-scrollbar-thumb { background: rgba(0,255,136,0.2); border-radius: 3px; }
        ::-webkit-scrollbar-thumb:hover { background: rgba(0,255,136,0.4); }

        /* ── TOAST ── */
        .toast {
            position: fixed;
            bottom: 24px;
            left: 50%;
            transform: translateX(-50%) translateY(10px);
            background: var(--neon);
            color: #000;
            font-family: var(--mono);
            font-size: 12px;
            font-weight: 700;
            letter-spacing: 1px;
            padding: 10px 20px;
            border-radius: 3px;
            z-index: 9999;
            opacity: 0;
            transition: all 0.25s;
            pointer-events: none;
        }

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

        /* ── NO MATCHES ── */
        .no-matches {
            padding: 16px;
            text-align: center;
            color: var(--muted);
            font-size: 12px;
            letter-spacing: 1px;
        }

        /* ── COPY SHARE BTN ── */
        .share-btn {
            font-family: var(--display);
            font-size: 11px;
            letter-spacing: 1px;
            padding: 5px 14px;
            border-radius: 3px;
            border: 1px solid var(--border);
            background: transparent;
            color: var(--muted);
            cursor: pointer;
            transition: all 0.15s;
        }

        .share-btn:hover {
            color: var(--neon2);
            border-color: rgba(0,204,255,0.4);
        }

        /* ── MOBILE adjustments ── */
        @media (max-width: 600px) {
            .regex-input { font-size: 14px; }
            .flags-wrap { gap: 3px; }
            .flag-btn { width: 26px; height: 26px; font-size: 11px; }
            .mode-btns { display: none; }
        }
        
/* ── FOOTER ── */
footer {
    margin-top: 0;
    padding: 40px 0 30px;
    border-top: 1px solid var(--border);
    text-align: center;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    background: var(--bg2);
}
.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 0;
    align-items: center;
}
.footer-links a {
    text-decoration: none;
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.5;
    transition: opacity 0.2s;
}
.footer-links a:hover {
    opacity: 1;
    color: var(--neon);
}
.footer-links a:not(:last-child)::after {
    content: '|';
    margin: 0 0.6em;
    opacity: 0.3;
    color: var(--muted);
}
.footer-copy {
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 1px;
}