 :root {
            --bg: #f6f8fc;
            --panel: #ffffff;
            --border: #dde4ef;
            --primary: #2563eb;
            --dark: #0f172a;
            --muted: #64748b;
            --success: #16a34a;
            --danger: #dc2626;
            --radius: 16px;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: Inter, Arial, sans-serif;
            background: var(--bg);
            color: var(--dark);
        }

        .wrapper {
            max-width: 1450px;
            min-height: 100vh;
            margin: auto;
            padding: 30px 22px 60px;
        }

        /* HERO */

        .hero {
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 20px;
            margin-bottom: 30px;
        }

        h1 {
            font-size: 40px;
            font-weight: 800;
            letter-spacing: -1px;
            margin-bottom: 10px;
        }

        .sub {
            color: var(--muted);
            font-size: 18px;
        }

        .badges {
            display: flex;
            gap: 12px;
            flex-wrap: wrap;
            margin-top: 15px;
        }

        .badge {
            background: white;
            border: 1px solid var(--border);
            padding: 10px 16px;
            border-radius: 999px;
            font-size: 14px;
            font-weight: 600;
        }


        /* TOOLBAR */

        .toolbar {
            background: var(--panel);
            border: 1px solid var(--border);
            padding: 18px;
            border-radius: var(--radius);
            display: flex;
            gap: 12px;
            flex-wrap: wrap;
            margin-bottom: 22px;
            box-shadow: 0 4px 16px rgba(0, 0, 0, .04);
        }

        button {
            border: none;
            background: var(--primary);
            color: white;
            padding: 12px 18px;
            border-radius: 12px;
            font-weight: 700;
            cursor: pointer;
            transition: .2s;
        }

        button:hover {
            transform: translateY(-1px);
        }

        .secondary {
            background: #eef4ff;
            color: #1747c7;
        }

        .danger {
            background: #fee2e2;
            color: #991b1b;
        }

        /* PANELS */

        .grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 22px;
        }

        .card {
            background: var(--panel);
            border: 1px solid var(--border);
            border-radius: 22px;
            padding: 20px;
            box-shadow: 0 4px 16px rgba(0, 0, 0, .04);
        }

        .cardhead {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 18px;
        }

        .cardhead h3 {
            font-size: 20px;
        }

        .mini {
            font-size: 13px;
            color: var(--muted);
        }

        .CodeMirror {
            height: 60vh;
            min-height: 300px;
            border: 1px solid var(--border);
            border-radius: 14px;
            font-size: 15px;
        }

        #tree {
             height: 60vh;
            min-height: 300px;
            border: 1px solid var(--border);
            border-radius: 14px;
            overflow: hidden;
        }
        #codePreview,
        #textPreview{
            display:none;
            height:640px;
            overflow:auto;
            padding:20px;
            border:1px solid #dde4ef;
            border-radius:14px;
            background:#f8fbff;

            font-family:monospace;
            font-size:14px;
            line-height:1.6;

            /* responsive fixes */
            white-space:pre-wrap;
            word-break:break-word;
            overflow-wrap:anywhere;
            max-width:100%;
            }

            /* nicer scrollbar */
            #codePreview::-webkit-scrollbar,
            #textPreview::-webkit-scrollbar{
            height:8px;
            width:8px;
            }

            #codePreview::-webkit-scrollbar-thumb,
            #textPreview::-webkit-scrollbar-thumb{
            background:#cbd5e1;
            border-radius:20px;
            }
        .status {
            margin-bottom: 15px;
            padding: 14px 18px;
            border-radius: 12px;
            display: none;
            font-weight: 700;
        }

        .success {
            display: block;
            background: #eafaf0;
            color: #166534;
        }

        .error {
            display: block;
            background: #fff1f1;
            color: #b91c1c;
        }

        .bottom-actions {
            display: flex;
            gap: 12px;
            flex-wrap: wrap;
            margin-top: 18px;
        }

        .dropzone {
            margin-top: 15px;
            padding: 12px;
            border: 2px dashed var(--border);
            border-radius: 14px;
            text-align: center;
            color: var(--muted);
            font-size: 12px;
        }

        .footer {
            margin-top: 40px;
            text-align: center;
            color: var(--muted);
            font-size: 14px;
        }

        kbd {
            background: #eef2ff;
            padding: 5px 8px;
            border-radius: 6px;
            font-size: 12px;
        }

        @media(max-width:1100px) {
            .grid {
                grid-template-columns: 1fr;
            }
        }

        .view-tabs {
            display: flex;
            gap: 10px;
            margin-bottom: 18px;
        }

        .tab {
            background: #eef3ff;
            color: #3156d3;
            border: none;
            padding: 11px 16px;
            border-radius: 12px;
            font-weight: 700;
        }

        .active-tab {
            background: #2563eb;
            color: white;
            box-shadow: 0 4px 12px rgba(37, 99, 235, .25);
        }

        .tool-actions {
            display: flex;
            gap: 12px;
            flex-wrap: wrap;
        }

        .tool-btn {
            background: #eef3ff;
            color: #3156d3;
            border: 1px solid #d8e3ff;
            padding: 12px 18px;
            border-radius: 12px;
            font-weight: 700;
            transition: .2s;
        }

        .tool-btn:hover {
            transform: translateY(-1px);
        }

        .active-action {
            background: #2563eb;
            color: #fff;
            border-color: #2563eb;
            box-shadow: 0 4px 14px rgba(37, 99, 235, .25);
        }
        .toolbar,
        .tool-actions,
        .bottom-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
        }

        button,
        .tool-btn {
            flex: 1 1 auto;
            text-align: center;
            padding: 10px 12px;
            font-size: 14px;
        }


@media (max-width: 768px) {
    .hero {
        flex-direction: column;
        align-items: flex-start;
    }

    h1 {
        font-size: 28px;
    }

    .sub {
        font-size: 15px;
    }
}
.view-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
}

.view-tabs button {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .wrapper {
        padding: 15px;
    }

    .card {
        padding: 15px;
    }
}
.icon-actions{
display:flex;
gap:10px;
flex-wrap:wrap;
align-items:center;
}

.icon-actions button{
display:flex;
align-items:center;
gap:8px;
}

.icon-actions svg{
flex-shrink:0;
}
@media (max-width:768px){

#codePreview,
#textPreview{
height:420px;
padding:14px;
font-size:12px;
line-height:1.5;
}

}
#codePreview{
white-space:pre;
overflow:auto;
}
#textPreview{
white-space:pre-wrap;
word-break:break-word;
}