/* ─── CSS Variables & Reset ─── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Dark Theme (default) */
    --bg-base: #0d0f17;
    --bg-panel: #141622;
    --bg-card: #1a1d2e;
    --bg-input: #12141f;
    --bg-hover: #1e2235;
    --bg-overlay: rgba(13, 15, 23, 0.92);

    --accent: #7c6aff;
    --accent-2: #48d6c8;
    --accent-glow: rgba(124, 106, 255, 0.25);
    --danger: #ff5a7e;
    --danger-bg: rgba(255, 90, 126, 0.12);
    --success: #3dd68c;
    --warning: #fcba03;

    --text-primary: #e8eaf0;
    --text-secondary: #8892a4;
    --text-muted: #4f566b;
    --text-code: #c3b5ff;

    --border: rgba(255, 255, 255, 0.07);
    --border-focus: rgba(124, 106, 255, 0.6);

    --highlight-1: rgba(124, 106, 255, 0.45);
    --highlight-1-border: #7c6aff;
    --highlight-2: rgba(72, 214, 200, 0.38);
    --highlight-2-border: #48d6c8;
    --highlight-3: rgba(252, 186, 3, 0.35);
    --highlight-3-border: #fcba03;
    --highlight-4: rgba(61, 214, 140, 0.35);
    --highlight-4-border: #3dd68c;
    --highlight-5: rgba(255, 90, 126, 0.32);
    --highlight-5-border: #ff5a7e;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.6);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    --font-ui: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    --panel-width: 310px;
    --transition: 0.2s ease;
}

/* Light Theme */
[data-theme="light"] {
    --bg-base: #f0f2f8;
    --bg-panel: #ffffff;
    --bg-card: #f7f8fc;
    --bg-input: #eef0f7;
    --bg-hover: #e8eaf5;
    --bg-overlay: rgba(240, 242, 248, 0.95);

    --accent: #5b4ee8;
    --accent-2: #0aa89c;
    --accent-glow: rgba(91, 78, 232, 0.15);
    --danger: #e0284f;
    --danger-bg: rgba(224, 40, 79, 0.08);
    --success: #1a9e5c;
    --warning: #d6920a;

    --text-primary: #1a1d2e;
    --text-secondary: #485470;
    --text-muted: #8892a4;
    --text-code: #5b4ee8;

    --border: rgba(0, 0, 0, 0.09);
    --border-focus: rgba(91, 78, 232, 0.5);

    --highlight-1: rgba(91, 78, 232, 0.22);
    --highlight-1-border: #5b4ee8;
    --highlight-2: rgba(10, 168, 156, 0.2);
    --highlight-2-border: #0aa89c;
    --highlight-3: rgba(214, 146, 10, 0.22);
    --highlight-3-border: #d6920a;
    --highlight-4: rgba(26, 158, 92, 0.2);
    --highlight-4-border: #1a9e5c;
    --highlight-5: rgba(224, 40, 79, 0.18);
    --highlight-5-border: #e0284f;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
}

html,
body {
    height: 100%;
    font-family: var(--font-ui);
    background: var(--bg-base);
    color: var(--text-primary);
    overflow-x: hidden;
    transition: background var(--transition), color var(--transition);
}

/* ─── Animated Background ─── */
.bg-blobs {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.12;
    animation: blobFloat 14s ease-in-out infinite alternate;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: var(--accent);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: var(--accent-2);
    bottom: -100px;
    right: -100px;
    animation-delay: -5s;
}

.blob-3 {
    width: 300px;
    height: 300px;
    background: var(--danger);
    top: 50%;
    left: 50%;
    animation-delay: -9s;
}

@keyframes blobFloat {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(30px, 20px) scale(1.08);
    }
}

[data-theme="light"] .blob {
    opacity: 0.06;
}

/* ─── App Shell ─── */
.app-shell {
    position: relative;
    z-index: 1;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar body-padding is handled by sidebar.css — no override needed here */

/* ─── Control Panel ─── */
.control-panel {
    width: var(--panel-width);
    min-width: var(--panel-width);
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0;
    flex-shrink: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.control-panel::-webkit-scrollbar {
    width: 4px;
}

.control-panel::-webkit-scrollbar-track {
    background: transparent;
}

.control-panel::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 99px;
}

/* Panel Header */
.cp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 18px 16px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, var(--bg-card), var(--bg-panel));
    flex-shrink: 0;
}

.cp-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cp-logo-icon {
    font-size: 1.8rem;
    line-height: 1;
}

.cp-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.cp-sub {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Theme Toggle Button */
.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-input);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all var(--transition);
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    transform: rotate(20deg);
}

/* Sections */
.cp-section {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}

.cp-section:last-child {
    border-bottom: none;
}

.cp-section-title {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cp-section-icon {
    font-size: 0.85rem;
}

/* Regex Input */
.regex-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.regex-input-wrapper:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.regex-input-wrapper.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(255, 90, 126, 0.15);
    animation: shake 0.35s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-5px);
    }

    40% {
        transform: translateX(5px);
    }

    60% {
        transform: translateX(-4px);
    }

    80% {
        transform: translateX(4px);
    }
}

.regex-delimiter {
    padding: 0 9px;
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 600;
    user-select: none;
    flex-shrink: 0;
}

.regex-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    padding: 10px 4px;
    min-width: 0;
}

.regex-input::placeholder {
    color: var(--text-muted);
}

.flags-display {
    padding: 0 10px;
    color: var(--accent-2);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    border-left: 1px solid var(--border);
    flex-shrink: 0;
    min-width: 28px;
    text-align: center;
}

/* Error banner */
.regex-error {
    display: none;
    margin-top: 8px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    background: var(--danger-bg);
    border: 1px solid rgba(255, 90, 126, 0.3);
    color: var(--danger);
    font-size: 0.75rem;
    font-family: var(--font-mono);
    line-height: 1.4;
    word-break: break-all;
}

.regex-error.show {
    display: block;
}

/* Flags Grid */
.flags-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.flag-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    transition: all var(--transition);
    user-select: none;
}

.flag-label:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.flag-label input.flag-cb {
    display: none;
}

.flag-label input.flag-cb:checked~.flag-pill {
    background: var(--accent);
    color: #fff;
}

.flag-label input.flag-cb:checked~.flag-name {
    color: var(--text-primary);
}

.flag-label:has(input:checked) {
    border-color: var(--accent);
    background: rgba(124, 106, 255, 0.08);
}

.flag-pill {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition);
}

.flag-name {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Toggle Switch (Replace Mode) */
.cp-section-collapsible {
    cursor: pointer;
    user-select: none;
}

.toggle-switch {
    margin-left: auto;
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.toggle-switch input {
    display: none;
}

.toggle-track {
    width: 38px;
    height: 20px;
    border-radius: 99px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    position: relative;
    transition: all var(--transition);
}

.toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all var(--transition);
}

.toggle-switch input:checked~.toggle-track {
    background: var(--accent);
    border-color: var(--accent);
}

.toggle-switch input:checked~.toggle-track::after {
    transform: translateX(18px);
    background: #fff;
}

/* Replace Section */
.replace-section {
    display: none;
    padding-top: 8px;
}

.replace-section.show {
    display: block;
}

.cp-label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
    font-weight: 500;
}

.cp-input {
    width: 100%;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 9px 11px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.cp-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.replace-hint {
    margin-top: 7px;
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.replace-hint code {
    color: var(--accent-2);
    font-family: var(--font-mono);
    background: var(--bg-card);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.72rem;
}

/* Quick Reference */
.collapsible-arrow {
    margin-left: auto;
    font-size: 0.65rem;
    transition: transform var(--transition);
}

.collapsible-arrow.collapsed {
    transform: rotate(-90deg);
}

.quick-ref {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.quick-ref.collapsed {
    max-height: 0 !important;
}

.qr-grid {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.qr-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
}

.qr-row:hover {
    background: var(--bg-hover);
}

.qr-row code {
    font-family: var(--font-mono);
    color: var(--accent);
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
    min-width: 52px;
    text-align: center;
    flex-shrink: 0;
}

.qr-row span {
    color: var(--text-secondary);
}

/* Action Buttons */
.cp-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-btn {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: none;
    font-family: var(--font-ui);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    transition: all var(--transition);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: #8f7fff;
    box-shadow: 0 0 20px var(--accent-glow);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent-2), var(--accent));
    color: #fff;
}

.btn-accent:hover {
    opacity: 0.9;
    box-shadow: 0 4px 16px rgba(72, 214, 200, 0.3);
}

/* ─── Main Workspace ─── */
.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-base);
}

/* Stats Bar */
.stats-bar {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 10px 20px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 0;
}

.stat-item {
    display: flex;
    align-items: baseline;
    gap: 5px;
    padding: 0 16px;
}

.stat-num {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
    font-family: var(--font-mono);
}

.stat-lbl {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.stat-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    flex-shrink: 0;
}

.stat-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    padding: 4px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.stat-badge.ready .badge-dot {
    background: var(--text-muted);
}

.stat-badge.match .badge-dot {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
}

.stat-badge.no-match .badge-dot {
    background: var(--warning);
}

.stat-badge.error .badge-dot {
    background: var(--danger);
    box-shadow: 0 0 6px var(--danger);
}

/* Editor Section */
.editor-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 16px 20px 0;
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.editor-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.editor-actions {
    display: flex;
    gap: 6px;
}

.icon-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-ui);
    display: flex;
    align-items: center;
    gap: 4px;
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent);
}

/* Editor Container (textarea + overlay) */
.editor-container {
    position: relative;
    flex: 1;
    min-height: 0;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border);
    overflow: hidden;
    background: var(--bg-input);
    transition: border-color var(--transition);
}

.editor-container:focus-within {
    border-color: var(--border-focus);
}

/* Highlight Overlay */
.highlight-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.7;
    padding: 14px 16px;
    color: transparent;
    border-radius: var(--radius-md);
    z-index: 1;
}

/* Match highlight marks */
.highlight-overlay mark {
    border-radius: 3px;
    color: transparent;
    position: relative;
}

.highlight-overlay mark.color-1 {
    background: var(--highlight-1);
    box-shadow: 0 0 0 1px var(--highlight-1-border);
}

.highlight-overlay mark.color-2 {
    background: var(--highlight-2);
    box-shadow: 0 0 0 1px var(--highlight-2-border);
}

.highlight-overlay mark.color-3 {
    background: var(--highlight-3);
    box-shadow: 0 0 0 1px var(--highlight-3-border);
}

.highlight-overlay mark.color-4 {
    background: var(--highlight-4);
    box-shadow: 0 0 0 1px var(--highlight-4-border);
}

.highlight-overlay mark.color-5 {
    background: var(--highlight-5);
    box-shadow: 0 0 0 1px var(--highlight-5-border);
}

/* Textarea */
.test-input {
    position: absolute;
    inset: 0;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-primary);
    padding: 14px 16px;
    width: 100%;
    height: 100%;
    z-index: 2;
    caret-color: var(--accent);
}

.test-input::placeholder {
    color: var(--text-muted);
}

.test-input::-webkit-scrollbar {
    width: 6px;
}

.test-input::-webkit-scrollbar-track {
    background: transparent;
}

.test-input::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 99px;
}

/* Replace Preview Section */
.replace-preview-section {
    display: none;
    flex-direction: column;
    padding: 12px 20px 0;
    flex-shrink: 0;
    max-height: 160px;
}

.replace-preview-section.show {
    display: flex;
}

.replace-preview {
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 15px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-primary);
    overflow-y: auto;
    flex: 1;
    white-space: pre-wrap;
    word-break: break-all;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.replace-preview ins {
    text-decoration: none;
    background: rgba(61, 214, 140, 0.25);
    color: var(--success);
    border-radius: 2px;
}

/* Match Details Section */
.match-details-section {
    flex-shrink: 0;
    padding: 12px 20px 16px;
    max-height: 240px;
    display: flex;
    flex-direction: column;
}

.match-details-count {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.match-list {
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.match-list::-webkit-scrollbar {
    width: 4px;
}

.match-list::-webkit-scrollbar-track {
    background: transparent;
}

.match-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 99px;
}

.match-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    color: var(--text-muted);
    text-align: center;
}

.placeholder-icon {
    font-size: 2rem;
    opacity: 0.4;
}

.match-placeholder p {
    font-size: 0.8rem;
}

/* Individual Match Card */
.match-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: border-color var(--transition);
    flex-shrink: 0;
}

.match-card:hover {
    border-color: var(--accent);
}

.match-num {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 2px 5px;
    background: var(--bg-input);
    border-radius: 4px;
    flex-shrink: 0;
    min-width: 28px;
    text-align: center;
    margin-top: 2px;
}

.match-info {
    flex: 1;
    min-width: 0;
}

.match-value {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-primary);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.match-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.match-meta span {
    display: flex;
    gap: 3px;
}

.match-meta b {
    color: var(--text-secondary);
    font-weight: 500;
}

.match-groups {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 6px;
}

.match-group {
    font-size: 0.7rem;
    font-family: var(--font-mono);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 7px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.match-group-label {
    color: var(--accent-2);
    font-weight: 600;
}

.match-group-value {
    color: var(--text-primary);
}

/* Color indicators per match */
.match-card.color-1 {
    border-left: 3px solid var(--highlight-1-border);
}

.match-card.color-2 {
    border-left: 3px solid var(--highlight-2-border);
}

.match-card.color-3 {
    border-left: 3px solid var(--highlight-3-border);
}

.match-card.color-4 {
    border-left: 3px solid var(--highlight-4-border);
}

.match-card.color-5 {
    border-left: 3px solid var(--highlight-5-border);
}

/* ─── Toast ─── */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 99px;
    box-shadow: var(--shadow-md);
    opacity: 0;
    transition: all 0.25s ease;
    z-index: 9999;
    pointer-events: none;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
    .app-shell {
        flex-direction: column;
        height: auto;
        overflow: auto;
    }

    .has-sidebar .app-shell {
        padding-left: 0;
    }

    .control-panel {
        width: 100%;
        min-width: 0;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .workspace {
        height: auto;
        flex: none;
    }

    .editor-section {
        height: 280px;
        padding-bottom: 16px;
    }

    .editor-container {
        position: relative;
    }

    .test-input,
    .highlight-overlay {
        position: absolute;
    }

    .match-details-section {
        max-height: none;
    }

    .replace-preview-section {
        max-height: none;
    }
}

@media (max-width: 600px) {
    .stats-bar {
        flex-wrap: wrap;
        row-gap: 8px;
    }

    .stat-badge {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }

    .stat-divider {
        display: none;
    }

    .stat-item {
        padding: 0 12px;
    }
}