.b2ce-wrap,
.b2ce-wrap *,
.b2ce-wrap *::before,
.b2ce-wrap *::after {
    box-sizing: border-box;
}

.b2ce-wrap {
    max-width: 100%;
    margin: 0;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    color: #1a1a2e;
    line-height: 1.5;
}

.b2ce-wrap h1,
.b2ce-wrap h2,
.b2ce-wrap h3,
.b2ce-wrap p {
    margin: 0;
}

.b2ce-wrap button {
    margin: 0;
    text-transform: none;
    letter-spacing: normal;
}

.b2ce-wrap textarea {
    margin: 0;
    text-transform: none;
    letter-spacing: normal;
}

.b2ce-header {
    text-align: center;
    margin-bottom: 20px;
}

.b2ce-title {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 6px;
    line-height: 1.3;
}

.b2ce-desc {
    color: #888;
    font-size: 13px;
    margin: 0;
}

.b2ce-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 10px;
    flex-wrap: wrap;
}

.b2ce-toolbar-left,
.b2ce-toolbar-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.b2ce-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    color: #444;
    white-space: nowrap;
    line-height: 1.4;
}

.b2ce-btn:hover {
    border-color: #4361ee;
    color: #4361ee;
}

.b2ce-btn-primary {
    background: #4361ee;
    color: #fff;
    border-color: #4361ee;
}

.b2ce-btn-primary:hover {
    background: #3a56d4;
    color: #fff;
}

.b2ce-btn-secondary {
    background: #f8f9fa;
    color: #555;
    border-color: #e0e0e0;
}

.b2ce-btn-secondary:hover {
    background: #e9ecef;
    border-color: #ccc;
    color: #333;
}

.b2ce-btn-icon {
    font-size: 14px;
    line-height: 1;
}

.b2ce-main {
    display: flex;
    height: calc(100vh - 200px);
    min-height: 500px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
}

.b2ce-layout-horizontal {
    flex-direction: row;
}

.b2ce-layout-vertical {
    flex-direction: column;
}

.b2ce-editors {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.b2ce-editor-tabs {
    display: flex;
    background: #f5f6f8;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.b2ce-editor-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #888;
    transition: all 0.2s;
    position: relative;
    line-height: 1.4;
}

.b2ce-editor-tab:hover {
    color: #4361ee;
    background: #eef0ff;
}

.b2ce-editor-tab.active {
    color: #4361ee;
    background: #fff;
}

.b2ce-editor-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #4361ee;
}

.b2ce-tab-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.b2ce-dot-html {
    background: #e44d26;
}

.b2ce-dot-css {
    background: #264de4;
}

.b2ce-dot-js {
    background: #f0db4f;
}

.b2ce-editor-panels {
    flex: 1;
    position: relative;
    min-height: 0;
    overflow: hidden;
}

.b2ce-editor-panel {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
}

.b2ce-editor-panel.active {
    display: flex;
    flex-direction: column;
}

.b2ce-editor-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    background: #1e1e2e;
}

.b2ce-line-numbers {
    width: 48px;
    padding: 12px 8px 12px 0;
    text-align: right;
    font-family: "Cascadia Code", "Fira Code", "JetBrains Mono", Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #6c7086;
    background: #1e1e2e;
    user-select: none;
    overflow: hidden;
    flex-shrink: 0;
    border-right: 1px solid #313244;
}

.b2ce-line-numbers div {
    height: 20.8px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
}

.b2ce-code-area {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.b2ce-highlight-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 12px;
    font-family: "Cascadia Code", "Fira Code", "JetBrains Mono", Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #cdd6f4;
    white-space: pre;
    overflow: auto;
    pointer-events: none;
    z-index: 1;
    background: transparent;
    word-wrap: normal;
}

.b2ce-highlight-layer code {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

.b2ce-code-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 12px;
    font-family: "Cascadia Code", "Fira Code", "JetBrains Mono", Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.6;
    color: transparent;
    caret-color: #f5e0dc;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    overflow: auto;
    white-space: pre;
    z-index: 2;
    -webkit-text-fill-color: transparent;
    tab-size: 4;
    -moz-tab-size: 4;
    word-wrap: normal;
}

.b2ce-code-input::selection {
    background: rgba(68, 97, 238, 0.3);
    -webkit-text-fill-color: #cdd6f4;
}

.b2ce-code-input::placeholder {
    color: #585b70;
    -webkit-text-fill-color: #585b70;
}

.b2ce-resizer {
    flex-shrink: 0;
    background: #e8e8e8;
    transition: background 0.2s;
    z-index: 10;
}

.b2ce-layout-horizontal .b2ce-resizer {
    width: 6px;
    cursor: col-resize;
}

.b2ce-layout-vertical .b2ce-resizer {
    height: 6px;
    cursor: row-resize;
}

.b2ce-resizer:hover,
.b2ce-resizer.b2ce-resizing {
    background: #4361ee;
}

.b2ce-preview {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: #fff;
}

.b2ce-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: #f5f6f8;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.b2ce-preview-title {
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

.b2ce-preview-actions {
    display: flex;
    gap: 4px;
}

.b2ce-btn-sm {
    width: 28px;
    height: 28px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: #666;
    padding: 0;
    line-height: 1;
}

.b2ce-btn-sm:hover {
    border-color: #4361ee;
    color: #4361ee;
}

.b2ce-preview-body {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: #fff;
}

.b2ce-preview-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: #fff;
}

.b2ce-console {
    border-top: 1px solid #e0e0e0;
    background: #1e1e2e;
    max-height: 180px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.b2ce-console.b2ce-console-collapsed {
    max-height: 32px;
    overflow: hidden;
}

.b2ce-console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 12px;
    background: #181825;
    border-bottom: 1px solid #313244;
    flex-shrink: 0;
    cursor: pointer;
}

.b2ce-console-title {
    font-size: 12px;
    font-weight: 600;
    color: #a6adc8;
}

.b2ce-console-header .b2ce-btn-sm {
    width: auto;
    height: auto;
    padding: 2px 8px;
    font-size: 11px;
    border-color: #45475a;
    color: #a6adc8;
    background: transparent;
}

.b2ce-console-header .b2ce-btn-sm:hover {
    border-color: #4361ee;
    color: #4361ee;
}

.b2ce-console-body {
    overflow-y: auto;
    padding: 6px 12px;
    font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
    font-size: 12px;
    line-height: 1.5;
    flex: 1;
    min-height: 0;
}

.b2ce-console-line {
    padding: 2px 0;
    border-bottom: 1px solid #313244;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    word-break: break-all;
}

.b2ce-console-line:last-child {
    border-bottom: none;
}

.b2ce-console-line.b2ce-log {
    color: #cdd6f4;
}

.b2ce-console-line.b2ce-warn {
    color: #f9e2af;
    background: rgba(249, 226, 175, 0.05);
}

.b2ce-console-line.b2ce-error {
    color: #f38ba8;
    background: rgba(243, 139, 168, 0.05);
}

.b2ce-console-line.b2ce-info {
    color: #89b4fa;
}

.b2ce-console-prefix {
    font-weight: 600;
    flex-shrink: 0;
    min-width: 36px;
}

.b2ce-console-text {
    flex: 1;
    min-width: 0;
}

.b2ce-fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.b2ce-fullscreen-overlay .b2ce-fullscreen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #f5f6f8;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.b2ce-fullscreen-overlay .b2ce-fullscreen-header h3 {
    margin: 0;
    font-size: 14px;
    color: #333;
}

.b2ce-fullscreen-overlay iframe {
    flex: 1;
    width: 100%;
    border: none;
}

.b2ce-highlight-layer .b2ce-hl-keyword {
    color: #cba6f7;
}

.b2ce-highlight-layer .b2ce-hl-string {
    color: #a6e3a1;
}

.b2ce-highlight-layer .b2ce-hl-number {
    color: #fab387;
}

.b2ce-highlight-layer .b2ce-hl-comment {
    color: #6c7086;
    font-style: italic;
}

.b2ce-highlight-layer .b2ce-hl-tag {
    color: #89b4fa;
}

.b2ce-highlight-layer .b2ce-hl-attr {
    color: #f9e2af;
}

.b2ce-highlight-layer .b2ce-hl-attr-value {
    color: #a6e3a1;
}

.b2ce-highlight-layer .b2ce-hl-selector {
    color: #89b4fa;
}

.b2ce-highlight-layer .b2ce-hl-property {
    color: #89dceb;
}

.b2ce-highlight-layer .b2ce-hl-value {
    color: #fab387;
}

.b2ce-highlight-layer .b2ce-hl-function {
    color: #89b4fa;
}

.b2ce-highlight-layer .b2ce-hl-operator {
    color: #89dceb;
}

.b2ce-highlight-layer .b2ce-hl-bracket {
    color: #f5c2e7;
}

.b2ce-highlight-layer .b2ce-hl-punctuation {
    color: #bac2de;
}

.b2ce-highlight-layer .b2ce-hl-doctype {
    color: #6c7086;
}

.b2ce-highlight-layer .b2ce-hl-entity {
    color: #f5c2e7;
}

.b2ce-highlight-layer .b2ce-hl-important {
    color: #f38ba8;
    font-weight: 600;
}

.b2ce-highlight-layer .b2ce-hl-at-rule {
    color: #cba6f7;
}

@media (max-width: 1200px) {
    .b2ce-main {
        height: calc(100vh - 220px);
    }
}

@media (max-width: 900px) {
    .b2ce-wrap {
        padding: 12px;
    }

    .b2ce-title {
        font-size: 20px;
    }

    .b2ce-main {
        height: calc(100vh - 240px);
        min-height: 400px;
    }

    .b2ce-layout-horizontal {
        flex-direction: column !important;
    }

    .b2ce-editors {
        flex: none;
        height: 50%;
    }

    .b2ce-preview {
        flex: none;
        height: 50%;
    }

    .b2ce-resizer {
        width: 100% !important;
        height: 6px !important;
        cursor: row-resize !important;
    }

    .b2ce-toolbar {
        gap: 6px;
    }

    .b2ce-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .b2ce-editor-tab {
        padding: 8px 14px;
        font-size: 12px;
    }
}

@media (max-width: 600px) {
    .b2ce-toolbar-left,
    .b2ce-toolbar-right {
        flex-wrap: wrap;
    }

    .b2ce-btn {
        padding: 5px 8px;
        font-size: 11px;
    }

    .b2ce-line-numbers {
        width: 36px;
        font-size: 11px;
    }

    .b2ce-highlight-layer,
    .b2ce-code-input {
        font-size: 12px;
        padding: 8px;
    }
}
