/* MLE Overlay V2 (MathLive) */
.mle-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(2px);
}

.mle-modal {
    background: #fff;
    width: 90%;
    max-width: 500px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: mleFadeIn 0.2s ease-out;
}

@keyframes mleFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.mle-header {
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mle-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #334155;
}

.mle-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
    line-height: 1;
}

.mle-body {
    padding: 1.5rem;
}

/* MathField Container */
.mle-input-area {
    margin-bottom: 1.5rem;
}

math-field {
    outline: none;
    /* MathLive variables */
    --keyboard-zindex: 10001;
}

/* Hide MathLive Interface Buttons */
math-field::part(menu-toggle),
math-field::part(virtual-keyboard-toggle) {
    display: none;
}

/* Toolbar */
.mle-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.mle-tool-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    color: #334155;
    min-width: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.mle-tool-btn:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
    transform: translateY(-1px);
}

.mle-footer {
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.mle-btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

.mle-btn-cancel {
    background: transparent;
    border: 1px solid #cbd5e1;
    color: #64748b;
}

.mle-btn-confirm {
    background: #2563eb;
    border: 1px solid #2563eb;
    color: #fff;
}

.mle-btn:hover {
    opacity: 0.9;
}