.flex {
    display: flex;
    justify-content: space-between;
}
.flex > :is(span, div) {
    flex: 1;
}
.flex > :is(span, div) + :is(span, div) {
    border-left: 1px solid #ddd;
    box-shadow: inset 1px 0 #fff;
}
.main-part {
    min-height: 520px;
    padding-left: 10px;
}

.result:empty::after {
    content: '当前不可预览';
    color: var(--ui-gray);
    display: grid;
    height: 300px;
    place-items: center;
}

.result canvas {
    width: 300px;
    height: auto;
    background-color: currentColor;
    display: block;
    margin: 12px auto;
}


:is(.preview, .origin) :where(.ui-textarea, .ui-textarea-x),
.preview pre {
    margin: 12px 10px;
}

.preview pre:not(:empty) {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
}

.preview pre:empty::after {
    content: '当前尚无代码';
    color: var(--ui-gray);
    display: grid;
    height: 300px;
    place-items: center;
    font-family: system-ui;
}

.center {
    text-align: center;
    margin-block: 1rem;
}

.green {
    color: var(--ui-green);
}
.red {
    color: var(--ui-red);
}
.blue {
    color: var(--ui-blue);
}

.clip {
    position: absolute;
    clip: rect(0 0 0 0);
}

/* 移动端布局兼容 */
@media (max-width: 640px) {
    h3.flex span:is(:first-child, :last-child) {
        display: none;
    }
    h3.flex span {
        padding: 0;
        border: 0;
    }

    .main-part {
        flex-direction: column;
        padding-left: 0;
    }

    .main-part > :is(.operate, .preview) {
        border-left: 0;
    }

    .operate {
        order: -1;
        border-bottom: 1px solid var(--ui-border);
    }

    :is(.preview, .origin):empty::after {
        height: 100px;
    }

    .preview::before,
    .origin::before {
        display: block;
        line-height: 30px;
        font-size: 15px;
        background: #f0f3f9;
        padding-left: 10px;
        border-bottom: 1px solid #ededed;
        color: #4e4e4e;
        text-shadow: 0px 1px 0px white;   
    }
    .origin::before {
        content: '原图';
    }
    .preview::before {
        content: '预览';
    }
    #preview {
        padding-left: 0;
    }
    .section-img {
        margin-left: 0;
    }
    .section-h {
        padding-inline: 10px;
    }
}