/* ============ 普通 <pre><code> 代码块：macOS 窗口样式 ============
   顶部窗口栏颜色跟随主题主色（后台「网站主色调」），由 --cherry-code-bar 提供
   ================================================================ */

.wznrys pre:not(.wp-block-code) {
    position: relative;
    margin: 24px 0 30px;
    padding: 40px 0 0;
    background: linear-gradient(to bottom,
        var(--cherry-code-bar, var(--bs-main, #c62541)) 0,
        var(--cherry-code-bar, var(--bs-main, #c62541)) 40px,
        #fff 40px,
        #fff 100%);
    border: 1px solid #e8e8ec;
    border-radius: 8px;
    box-shadow: 0 2px 14px rgba(0, 0, 0, .05);
    overflow: hidden;
    text-align: left;
}

/* 左上角三个窗口圆点 */
.wznrys pre:not(.wp-block-code)::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 14px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #ff5f57;
    box-shadow: 19px 0 0 #febc2e, 38px 0 0 #28c840;
    z-index: 2;
}

/* 右上角站点名（默认 yihubaba.com，可用 --cherry-code-label 或 filter 改） */
.wznrys pre:not(.wp-block-code)::after {
    content: var(--cherry-code-label, "yihubaba.com");
    position: absolute;
    right: 92px;
    top: 16px;
    font-size: 11px;
    line-height: 1;
    letter-spacing: .5px;
    color: rgba(255, 255, 255, .75);
    font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    z-index: 2;
}

/* 复制按钮 */
.wznrys pre:not(.wp-block-code) .cherry-copy {
    position: absolute;
    right: 12px;
    top: 11px;
    z-index: 3;
    margin: 0;
    padding: 5px 10px;
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: 5px;
    background: transparent;
    color: #fff;
    font-size: 11px;
    line-height: 1;
    font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    cursor: pointer;
    transition: background-color .18s ease, border-color .18s ease;
    -webkit-appearance: none;
    appearance: none;
}

.wznrys pre:not(.wp-block-code) .cherry-copy:hover {
    background: rgba(255, 255, 255, .18);
}

.wznrys pre:not(.wp-block-code) .cherry-copy.is-copied {
    background: rgba(255, 255, 255, .3);
    border-color: transparent;
}

.wznrys pre:not(.wp-block-code) .cherry-copy.is-failed {
    background: rgba(0, 0, 0, .18);
    border-color: transparent;
}

/* 代码区 */
.wznrys pre:not(.wp-block-code) code {
    display: block;
    position: relative;
    padding: 14px 18px 16px;
    background: #fff;
    color: #383a42;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 13px;
    line-height: 1.9;
    border-radius: 0 0 8px 8px;
    white-space: pre;
    overflow-x: auto;
}

/* 行号（highlightjs-line-numbers 生成的表格） */
.wznrys pre:not(.wp-block-code) code table {
    border: none;
    margin: 0;
    width: 100%;
    font-size: 13px;
    line-height: 1.9;
}

.wznrys pre:not(.wp-block-code) code table tr,
.wznrys pre:not(.wp-block-code) code table tr:nth-child(odd) {
    background: none;
}

.wznrys pre:not(.wp-block-code) code table tr td {
    border: none;
    padding: 0;
    line-height: 1.9;
    vertical-align: top;
}

.wznrys pre:not(.wp-block-code) code table tr td.hljs-ln-numbers {
    width: 34px;
    padding-right: 10px;
    text-align: right;
    -webkit-user-select: none;
    user-select: none;
}

.wznrys pre:not(.wp-block-code) code table tr td.hljs-ln-numbers .hljs-ln-n {
    color: #c9c9cf;
    font-size: 12px;
    font-weight: 300;
}

.wznrys pre:not(.wp-block-code) code table tr td.hljs-ln-code {
    padding-left: 14px;
    border-left: 1px solid #ececf0;
}

/* 深色模式：只调边框，代码区保持浅底（主题的高亮配色是浅色方案，深底会看不清） */
.dark .wznrys pre:not(.wp-block-code) {
    border-color: #000;
    box-shadow: none;
}

/* 手机端收紧一点 */
@media (max-width: 767px) {
    .wznrys pre:not(.wp-block-code) code {
        padding: 12px 12px 14px;
    }

    .wznrys pre:not(.wp-block-code) code table tr td.hljs-ln-code {
        padding-left: 10px;
    }
}

/* 很窄的屏幕只留复制按钮，避免站点名和按钮挤在一起 */
@media (max-width: 420px) {
    .wznrys pre:not(.wp-block-code)::after {
        content: none;
    }
}
