@charset "UTF-8";
/*
 * 在线代码编辑器（/devtools/online-editor.htm）专用样式
 * 布局说明：本页已移除站点顶部导航栏、“更多工具”与“关于”栏目以及全部开发工具广告位，
 *           改为工具自身撑满视口的独立应用布局：
 *           顶部工具条 + [历史代码侧栏 | 编辑区 / 预览区] + 版权行。
 * 注意：页面中还有一段 <style type="text/tailwindcss">，内含 @layer/@apply，
 *       必须保留在页面内由 Tailwind Play CDN 编译，不能放到外部 CSS 文件，
 *       所以这里只放普通 CSS。
 */

/*=============================== 全局与骨架 ===============================*/
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #f5f7fa;
}

/* 兜底：不依赖 Tailwind Play CDN，保证加载指示器的显示/隐藏始终生效 */
.hidden {
    display: none !important;
}

.oe_app,
.oe_app * {
    box-sizing: border-box;
}

.oe_app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    font-family: "Inter", "Microsoft YaHei", system-ui, sans-serif;
    color: #1d2129;
    background: #eaeff4;
}

/*=============================== 顶部工具条 ===============================*/
/* 与站点主页导航对齐：白底 + 底部细线 + 深灰文字 + 品牌蓝点缀 */
.oe_toolbar {
    flex: 0 0 auto;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 52px;
    padding: 0 16px;
    color: #333842;
    background: #fff;
    border-bottom: 1px solid #eeeeee;
}
.oe_toolbar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.oe_logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    font-size: 16px;
    border-radius: 8px;
    color: #0989E2;
    background: #f4f7fa;
}
.oe_brand__text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    line-height: 1.25;
}
.oe_brand__text strong {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
}
.oe_brand__text span {
    font-size: 11px;
    color: #9aa4b0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* 返回“更多工具”快捷入口 */
.oe_back {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: 0 0 auto;
    height: 26px;
    padding: 0 10px;
    margin-left: 4px;
    font-size: 12px;
    white-space: nowrap;
    text-decoration: none;
    color: #0989E2;
    border: 1px solid #0989E2;
    border-radius: 13px;
    background: transparent;
    transition: background .2s ease-in-out, border-color .2s ease-in-out;
}
.oe_back:hover {
    background: rgba(9,137,226, .08);
    border-color: #0989E2;
}
.oe_back .fa {
    font-size: 12px;
}

/* 常用操作与次要操作之间的竖线分隔 */
.oe_divider {
    flex: 0 0 auto;
    width: 1px;
    height: 20px;
    margin: 0 2px;
    background: #e5e6eb;
}

.oe_toolbar__actions {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
}

/* 自动执行开关 */
.oe_switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    border-radius: 6px;
    background: #f4f7fa;
    transition: background .2s ease-in-out;
}
.oe_switch:hover {
    background: #e9eef5;
}
.oe_switch input {
    margin: 0;
    cursor: pointer;
}

/* 工具条按钮 */
.oe_btn,
.oe_icon_btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border: none;
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
    color: #333842;
    border-radius: 6px;
    background: #f4f7fa;
    transition: background .2s ease-in-out, transform .1s ease-in-out;
}
.oe_icon_btn {
    width: 32px;
    padding: 0;
    justify-content: center;
}
.oe_btn:hover,
.oe_icon_btn:hover {
    background: #e9eef5;
}
.oe_btn:active,
.oe_icon_btn:active {
    transform: scale(.94);
}
.oe_btn--primary {
    font-weight: 600;
    color: #fff;
    background: #0989E2;
}
.oe_btn--primary:hover {
    background: #2f5a8c;
}
.oe_btn .fa,
.oe_icon_btn .fa {
    font-size: 13px;
}

/*=============================== 主体容器 ===============================*/
.oe_main {
    position: relative;
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    align-items: stretch;
    overflow: hidden;
}

/*=============================== 左侧历史代码 ===============================*/
.oe_sidebar {
    position: relative;
    flex: 0 0 244px;
    width: 244px;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-right: 1px solid #e3e8ef;
    overflow: hidden;
    transition: margin-left .22s ease-in-out, transform .22s ease-in-out;
}
.oe_app.oe-sidebar-off .oe_sidebar {
    margin-left: -245px;
}

.oe_sidebar__head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 34px;
    padding: 0 8px 0 12px;
    background: #f7f9fb;
    border-bottom: 1px solid #e3e8ef;
}
.oe_sidebar__title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #4e5969;
    white-space: nowrap;
}
.oe_sidebar__title .fa {
    color: #0989E2;
}
.oe_sidebar__ops {
    display: flex;
    align-items: center;
    gap: 4px;
}
.oe_sidebar__op {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 22px;
    padding: 0 6px;
    border: none;
    font-size: 12px;
    cursor: pointer;
    color: #4e5969;
    border-radius: 4px;
    background: transparent;
    transition: background .2s ease-in-out, color .2s ease-in-out;
}
.oe_sidebar__op:hover {
    color: #0989E2;
    background: rgba(9,137,226, 0.08);
}
.oe_sidebar__op--icon {
    width: 22px;
    padding: 0;
    justify-content: center;
}

.oe_sidebar__list {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    padding: 6px;
}
.oe_sidebar__empty {
    padding: 24px 12px;
    font-size: 12px;
    line-height: 1.8;
    color: #86909c;
    text-align: center;
}

.oe_history__item {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    padding: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    border: 1px solid #eef1f5;
    border-radius: 6px;
    background: #fff;
    transition: border-color .2s ease-in-out, background .2s ease-in-out;
}
.oe_history__item:hover {
    border-color: #b3cfdd;
    background: #f4f7fa;
}
.oe_history__item.is-active {
    border-color: #0989E2;
    background: #f4f7fa;
}
.oe_history__main {
    flex: 1 1 0;
    min-width: 0;
}
.oe_history__title {
    font-size: 13px;
    font-weight: 600;
    color: #1d2129;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.oe_history__meta {
    margin-top: 3px;
    font-size: 11px;
    color: #86909c;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.oe_history__del {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: #86909c;
    border-radius: 4px;
    background: transparent;
    transition: background .2s ease-in-out, color .2s ease-in-out;
}
.oe_history__del:hover {
    color: #f53f3f;
    background: #ffece8;
}

.oe_sidebar__foot {
    flex: 0 0 auto;
    height: 26px;
    line-height: 26px;
    padding: 0 12px;
    font-size: 11px;
    color: #86909c;
    overflow: hidden;
    white-space: nowrap;
    background: #f7f9fb;
    border-top: 1px solid #e3e8ef;
}
.oe_sidebar__foot b {
    color: #4e5969;
}

/*=============================== 工作区 ===============================*/
.oe_workspace {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: stretch;
    background: #eaeff4;
}

.oe_pane {
    flex: 1 1 50%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
}
#editorPane {
    flex: 0 0 50%;
}

.oe_pane__head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 600;
    color: #4e5969;
    background: #f7f9fb;
    border-bottom: 1px solid #e3e8ef;
}
.oe_pane__head .fa {
    color: #0989E2;
}

.oe_pane__body {
    flex: 1 1 0;
    min-height: 0;
    position: relative;
    overflow: hidden;
}
.oe_pane__body--preview {
    background: #fff;
}

/* 编辑区底部：字符数 + 使用提示 */
.oe_pane__foot {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 28px;
    padding: 0 12px;
    overflow: hidden;
    font-size: 12px;
    background: #f7f9fb;
    border-top: 1px solid #e3e8ef;
}
.oe_pane__count {
    flex: 0 0 auto;
    color: #4e5969;
    white-space: nowrap;
}
.oe_pane__tip {
    flex: 1 1 auto;
    min-width: 0;
    color: #86909c;
    text-align: right;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

#editor-container {
    width: 100%;
    height: 100%;
}

#previewFrame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

/* 可拖拽分隔条 */
.oe_splitter {
    flex: 0 0 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: col-resize;
    background: #dfe4ea;
    transition: background .2s ease-in-out;
}
.oe_splitter:hover,
body.oe_dragging .oe_splitter {
    background: #0989E2;
}
.oe_splitter span {
    width: 2px;
    height: 26px;
    border-radius: 2px;
    background: #b7bfcb;
}
body.oe_dragging {
    user-select: none;
    cursor: col-resize;
}
body.oe_dragging * {
    cursor: col-resize !important;
}

/* 预览加载指示器 */
.oe_loader {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .8);
}
.oe_loader__spin {
    width: 32px;
    height: 32px;
    border: 3px solid #dbe7ef;
    border-top-color: #0989E2;
    border-radius: 50%;
    animation: oe-spin .8s linear infinite;
}
@keyframes oe-spin {
    to {
        transform: rotate(360deg);
    }
}

/*=============================== 版权行 ===============================*/
.oe_copyright {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    min-height: 32px;
    padding: 6px 16px;
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
    color: #86909c !important;
    background: #fff;
    border-top: 1px solid #e3e8ef;
}
.oe_copyright a {
    color: #86909c !important;
    text-decoration: none;
}
.oe_copyright a:hover {
    color: #0989E2 !important;
}

/*=============================== 轻提示 ===============================*/
.oe_toast {
    position: fixed;
    top: 64px;
    left: 50%;
    z-index: 999;
    padding: 8px 16px;
    font-size: 13px;
    color: #fff;
    border-radius: 6px;
    background: rgba(29, 33, 41, .9);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -8px);
    transition: opacity .22s ease-in-out, transform .22s ease-in-out;
}
.oe_toast--show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/*=============================== 小屏适配 ===============================*/
@media screen and (max-width: 1366px) {
    .oe_brand__text span {
        display: none;
    }
}
@media screen and (max-width: 1200px) {
    .oe_btn,
    .oe_switch {
        padding: 0 9px;
    }
    .oe_btn span,
    .oe_switch span {
        display: none;
    }
}

@media screen and (max-width: 1023px) {
    html, body {
        height: auto;
        overflow: auto;
    }
    .oe_app {
        height: auto;
        min-height: 100vh;
    }
    .oe_toolbar {
        height: auto;
        padding: 8px 12px;
        flex-wrap: wrap;
    }
    .oe_toolbar__actions {
        flex-wrap: wrap;
    }
    .oe_main {
        display: block;
        overflow: visible;
        min-height: 0;
    }
    /* 侧栏在小屏改为浮层，收起时移出屏幕 */
    .oe_sidebar {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 35;
        box-shadow: 2px 0 10px rgba(0, 0, 0, .18);
    }
    .oe_app.oe-sidebar-off .oe_sidebar {
        margin-left: 0;
        transform: translateX(-100%);
    }
    .oe_workspace {
        flex-direction: column;
    }
    .oe_splitter {
        display: none;
    }
    .oe_pane,
    #editorPane {
        flex: 1 1 auto;
    }
    .oe_pane__body {
        flex: 0 0 auto;
        height: 60vh;
    }
    .oe_pane__foot {
        height: auto;
        padding: 6px 12px;
        flex-wrap: wrap;
    }
    .oe_pane__tip {
        text-align: left;
        white-space: normal;
    }
}

/*=============================== 库/模板选择弹窗 ===============================*/
.library-item:hover, .version-item:hover {
    background-color: rgba(59, 130, 246, 0.1);
    cursor: pointer;
}
.library-item.selected, .version-item.selected {
    background-color: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
}
.file-item:hover {
    background-color: rgba(59, 130, 246, 0.05);
    cursor: pointer;
}
.file-item.selected {
    background-color: rgba(59, 130, 246, 0.1);
}

/*=============================== Monaco 编辑器样式隔离 ===============================*/
/* 给编辑器容器加隔离样式 */
.monaco-editor * {
    box-sizing: content-box !important;
    line-height: inherit !important;
    font-family: "Consolas", "monospace" !important;
}
/* 核心：重置编辑器容器内的所有样式，隔离全局影响 */
.monaco-editor-wrapper {
    all: unset !important;
    width: 800px !important;
    height: 500px !important;
    display: block !important;
    position: relative !important;
    border: 1px solid #e0e0e0;
}
/* 重置 Monaco 内部核心元素样式，覆盖全局污染 */
.monaco-editor-wrapper .monaco-editor {
    all: revert !important;
    width: 100% !important;
    height: 100% !important;
    font-family: var(--monaco-font, "Consolas", "Monaco", "Courier New", monospace) !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    box-sizing: border-box !important;
}
/* 修复 Monaco 内部关键元素的布局 */
.monaco-editor-wrapper .monaco-editor * {
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    line-height: normal !important;
    font-family: inherit !important;
}
/* 单独修复行号、滚动条等易错乱的组件 */
.monaco-editor-wrapper .monaco-editor .margin {
    width: 40px !important;
    background: #f5f5f5 !important;
}
.monaco-editor-wrapper .monaco-editor .editor-scrollable {
    left: 40px !important;
    width: calc(100% - 40px) !important;
}
/* 修复全局 body { font-size: 16px } 导致编辑器字体过大 */
.monaco-editor-wrapper .monaco-editor .mtk1 {
    font-size: 14px !important;
}
/* 修复全局 * { margin: 5px } 导致行号偏移 */
.monaco-editor-wrapper .monaco-editor .line-numbers {
    margin: 0 !important;
}
/* 修复 Monaco 右键菜单核心样式 */
.context-view .monaco-menu * {
    color: #FFF !important;
}
