.preview-header {
    min-height: 36px; /* 添加固定高度 */
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.preview-tabs {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.preview-tabs.hidden {
    opacity: 0;
    visibility: hidden;
    position: absolute;
    pointer-events: none;
}

/* 统一侧边栏基础样式 */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 60%;
    display: flex;
    flex-direction: column;
    background: white;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease-out; /* 改为 ease-out 以优化动画流畅度 */
    z-index: 50;
}
.dark .sidebar {
    background: #2f3033;
    border-left: 1px solid rgba(255, 255, 255, .1);
    box-shadow: -5px 0 15px #0003;
}

/* 移动端侧边栏样式 */
.sidebar-mobile {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-height: 75vh;
    border-top-left-radius: 1.5rem;
    border-top-right-radius: 1.5rem;
    background: white;
    transform: translateY(100%);
    transition: transform 0.3s ease-out; /* 为移动端添加 ease-out 过渡 */
    box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.1);
    z-index: 50;
    display: flex;
    flex-direction: column;
}
.dark .sidebar {
    background: #2f3033;
    border-left: 1px solid rgba(255, 255, 255, .1);
    box-shadow: -5px 0 15px #0003;
}
.dark .sidebar-mobile {
    background: #2f3033;
    border-top-left-radius: 1.5rem;
    border-top-right-radius: 1.5rem;
    border: 1px solid rgba(255, 255, 255, .1);
    box-shadow: -5px 0 15px #0003;
}

/* 打开状态 */
.sidebar.open {
    transform: translateX(0);
}
.sidebar-mobile.open {
    transform: translateY(0);
}
.preview-tabs {
    font-size: 0.875rem;
    padding: 0.15rem;
    width: fit-content;
    background-color: #e6e7eb;
    border-radius: 0.5rem;
    position: sticky; /* 添加 sticky 定位 */
    top: 0; /* 固定在顶部 */
    left: 0; /* 固定在左侧 */
    z-index: 999; /* 确保按钮在内容之上 */
}
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
    z-index: 999; /* 确保按钮在内容之上 */
}

.copy-btn {
    position: fixed;
    right: 1.4rem; /* 固定在右侧 */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 0.375rem;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 999; /* 确保按钮在内容之上 */
}

.copy-btn:hover {
    background: #e5e7eb;
}

.copy-btn.copied {
    color: #10b981;
}
code[class*=language-],pre[class*=language-] {
    color: #000;
    background: 0 0;
    font-family: Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;
    font-size: 0.91em;
    text-align: left;
    white-space: pre;
    word-spacing: normal;
    word-break: normal;
    word-wrap: normal;
    line-height: 1.5;
    -moz-tab-size: 4;
    -o-tab-size: 4;
    tab-size: 4;
    -webkit-hyphens: none;
    -moz-hyphens: none;
    -ms-hyphens: none;
    hyphens: none
}

code[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,pre[class*=language-]::-moz-selection {
    text-shadow: none;
    background: #b3d4fc
}

code[class*=language-] ::selection,code[class*=language-]::selection,pre[class*=language-] ::selection,pre[class*=language-]::selection {
    text-shadow: none;
    background: #b3d4fc
}

@media print {
    code[class*=language-],pre[class*=language-] {
        text-shadow: none
    }
}

:not(pre)>code[class*=language-],pre[class*=language-] {
    background: #ffffff
}

:not(pre)>code[class*=language-] {
    padding: .1em;
    border-radius: .3em;
    white-space: normal
}

.token.cdata,.token.comment,.token.doctype,.token.prolog {
    color: #708090
}

.token.punctuation {
    color: #999
}

.token.namespace {
    opacity: .7
}

.token.boolean,.token.constant,.token.deleted,.token.number,.token.property,.token.symbol,.token.tag {
    color: #905
}

.token.attr-name,.token.builtin,.token.char,.token.inserted,.token.selector,.token.string {
    color: #690
}

.language-css .token.string,.style .token.string,.token.entity,.token.operator,.token.url {
    color: #9a6e3a;
    background: hsla(0,0%,100%,.5)
}

.token.atrule,.token.attr-value,.token.keyword {
    color: #07a
}

.token.class-name,.token.function {
    color: #dd4a68
}

.token.important,.token.regex,.token.variable {
    color: #e90
}

.token.bold,.token.important {
    font-weight: 700
}

.token.italic {
    font-style: italic
}

.token.entity {
    cursor: help
}
pre[class*=language-].line-numbers {
    overflow: auto;
    height: 100%;
    position: relative;
    padding-left: 3.8em;
    counter-reset: linenumber
}

pre[class*=language-].line-numbers>code {
    display: block;
    position: relative;
    white-space: inherit;
}

.line-numbers .line-numbers-rows {
    position: absolute;
    pointer-events: none;
    top: 0;
    font-size: 100%;
    left: -3.8em;
    width: 3em;
    letter-spacing: -1px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none
}

.line-numbers-rows>span {
    display: block;
    counter-increment: linenumber
}

.line-numbers-rows>span:before {
    content: counter(linenumber);
    color: #999;
    display: block;
    padding-right: .8em;
    text-align: right
}