:root, [data-bs-theme=dark] {
    --bs-font-sans-serif: "MiSans VF", sans-serif, "Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";
    --bg-auto-rgb: 10, 12, 25;
    --link-color-rgba: 222, 226, 230, 0.8;
    --link-color-second-rgba: 222, 226, 230, .65;
    --primary-color-rgba: 13, 110, 253;
    --primary-bg-rgba: 13,110,253, .2;

}

:root, [data-bs-theme=light] {
    --bg-auto-rgb: 245,245,244;
    --bs-font-sans-serif: "MiSans VF", sans-serif, "Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";
    --link-color-rgba: 0, 0, 0, 1;
    --link-color-second-rgba: 0, 0, 0, .65;
    --primary-color-rgba: 13, 110, 253;
    --primary-bg-rgba: 13,110,253, .2;
}

/*:root, [data-bs-theme=light] {*/
/*    --bg-auto-rgb: 245,245,244;*/
/*    --bs-font-sans-serif: 'hm', sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";*/
/*    --link-color-rgba: 0, 0, 0, 1;*/
/*    --link-color-second-rgba: 0, 0, 0, .65;*/
/*    --primary-color-rgba: 0, 0, 0, 1;*/
/*    --primary-bg-rgba: 0, 0, 0, .2;*/
/*}*/


html {
    scroll-padding-top: 120px;
}

*, body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: rgba(var(--link-color-rgba));
    transition: .15s all ease-in-out;
}

a:hover, a:focus, a:focus-visible {
    text-decoration: none;
    color: rgba(var(--primary-color-rgba));
}

.bg-auto {
    --bg-auto-opacity: 1;
    background-color: rgba(var(--bg-auto-rgb), var(--bg-auto-opacity)) !important;
}

#left {
    min-height: 100vh;
    z-index: 1030;
}

#left .nav-link {
    display: block;
    width: 50px;
    height: 50px;
    color: rgba(var(--link-color-rgba));
}

#left .nav-link i {
    font-size: 24px;
    padding-top: .75rem !important;
    padding-bottom: .75rem !important;
    padding-right: 1rem !important;
    padding-left: 1rem !important;
    border-radius: var(--bs-border-radius) !important;
    transition: all .15s ease-in-out;
}

#left .nav-link i:hover {
    background: rgba(var(--primary-bg-rgba));
    color: rgba(var(--primary-color-rgba));
}

#left .nav-item-title {
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 10px;
    display: none;
    padding-top: .27rem !important;
    padding-bottom: .27rem !important;
    padding-right: 1rem !important;
    padding-left: 1rem !important;
    border-radius: var(--bs-border-radius) !important;
    z-index: 1050;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
    white-space: nowrap;
    pointer-events: none;
}

#left .nav-item:hover .nav-item-title {
    display: block;
    background: rgba(var(--primary-bg-rgba));
    color: rgba(var(--primary-color-rgba));
    transition: all .15s ease-in-out;
}

#middle .navbar-background {
    backdrop-filter: blur(6px);
}

#middle #form-search-icon {
    color: rgba(var(--link-color-second-rgba));
}

#middle #form-search-icon:hover {
    background: rgba(var(--primary-bg-rgba));
    color: rgba(var(--primary-color-rgba));
}

#middle #search-input, #middle #search-input-mobile {
    width: 0;
    transition: all .25s ease-in-out;
    background: rgba(0, 0, 0, 0);
}

#middle #search-input:focus, #middle #search-input:focus-visible {
    outline: none;
    width: 150px;
}

#middle #navbarNavLeft .nav-link {
}

#middle .navbar-nav .active, #middle #navbarNavLeft .nav-link:hover {
    color: rgba(var(--primary-color-rgba));
    box-shadow: 0 -6px 0 0 rgba(var(--primary-bg-rgba)) inset;
    transition: all .25s ease-in-out;
}

#middle .thumbnail {
    width: 200px;
    height: 130px;
    flex: 0 0 auto;
    background-origin: border-box;
    background-position: 50%;
    background-size: cover;
}

#middle #index-content a {
    color: rgba(var(--link-color-rgba));
}

#middle #index-content a:hover {
    color: rgba(var(--primary-color-rgba));
}

#middle .top-up-flag, #middle .read-more {
    color: rgba(var(--primary-color-rgba));
}

#middle .moment-body {
    background: rgba(var(--primary-bg-rgba));
}

#content img {
    display: block;
    max-width: 100%;
    height: auto;
}

#pagination a, .sub-category a {
    position: relative;
    display: block;
    padding: var(--bs-pagination-padding-y) var(--bs-pagination-padding-x);
    font-size: var(--bs-pagination-font-size);
    color: rgba(var(--link-color-second-rgba)) !important;
    text-decoration: none;
    background-color: rgb(var(--bg-auto-rgb));
    transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
    border-radius: var(--bs-border-radius) !important;
}

#pagination .current a, #pagination a:hover, .sub-category a:hover {
    z-index: 3;
    background: rgba(var(--primary-bg-rgba));
    color: rgba(var(--primary-color-rgba)) !important;
}

#post-article a {
    color: rgba(var(--link-color-rgba));
}

#post-article a:hover {
    color: rgba(var(--primary-color-rgba));
}

#post-content a {
    color: rgba(var(--primary-color-rgba));
    box-shadow: 0 -6px 0 0 rgba(var(--primary-bg-rgba)) inset;
    transition: box-shadow 0.2s ease-in;
}

#post-content a:hover {
    color: rgba(var(--primary-color-rgba));
    box-shadow: 0 -10px 0 0 rgba(var(--primary-bg-rgba)) inset;
    transition: box-shadow 0.2s ease-in;
}


#post-content img {
    display: block;
    max-width: 100%;
    height: auto;
    margin-bottom: 36px;
}

#post-content .tags {
    display: flex;
}

#post-content .tags a {
    color: RGBA(var(--bs-secondary-rgb), var(--bs-link-opacity, 1)) !important;
}

#post-content blockquote, .text-border-left {
    --bs-text-opacity: 1;
    color: rgba(var(--link-color-second-rgba)) !important;
    border-left: 4px solid rgba(var(--link-color-second-rgba));
    font-weight: 400;
    letter-spacing: 0.01rem;
    padding-left: 10px;
}

#post-content blockquote p:last-child {
    margin-bottom: 0;
}

.form-control, button {
    box-shadow: none !important;
}

.form-control:focus {
    border-color: rgba(var(--primary-color-rgba)) !important;;
}

.avatar {
    border-radius: var(--bs-border-radius) !important;
}

#comments a {
    color: rgba(var(--link-color-rgba));
}

#comments a:hover {
    color: rgba(var(--primary-color-rgba));
}

.comment-reply a {
    color: rgba(var(--primary-color-rgba)) !important;
    box-shadow: 0 -6px 0 0 rgba(var(--primary-bg-rgba)) inset;
    transition: all .25s ease-in-out;
}

.comment-reply a:hover {
    box-shadow: 0 -10px 0 0 rgba(var(--primary-bg-rgba)) inset;
}

.cancel-comment-reply {
    display: flex;
}

.cancel-comment-reply a {
    padding: 0.375rem 0.75rem;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    line-height: 1.5;
    border-radius: 0.375rem;
}

#comments button, .cancel-comment-reply a {
    background: rgba(var(--primary-bg-rgba));
    color: rgba(var(--primary-color-rgba)) !important;
    border: 0;
}

#comments button:hover, .cancel-comment-reply a:hover {
    background: rgba(var(--primary-bg-rgba));
    color: rgba(var(--primary-color-rgba));
    border: 0;
}

#right a {
    color: rgba(var(--link-color-second-rgba));
}

#right a:hover {
    color: rgba(var(--primary-color-rgba));
}

#mobile-navbar button {
    background: rgba(var(--primary-bg-rgba));
    color: rgba(var(--primary-color-rgba));
}

#mobile-navbar .list-group-item.active {
    background: rgba(var(--primary-bg-rgba));
}

#post-content h1, #post-content h2, #post-content h3 {
    display: inline-block;
    box-shadow: 0 -10px 0 0 rgba(var(--primary-bg-rgba)) inset;
    padding: 0 3px;
    font-size: calc(1.275rem + .3vw)!important
}

@media (min-width: 1400px) {
    .container, .container-lg, .container-md, .container-sm, .container-xl, .container-xxl {
        max-width: 1200px;
    }
    #post-content h1, #post-content h2, #post-content h3 {
        font-size: 1.5rem!important;
    }
}

/* ===== 1. 代码块 macOS 风格 ===== */
.code-block-wrapper {
    margin: 0 0 1.6em 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .20), 0 2px 8px rgba(0, 0, 0, .10);
    border: 1px solid rgba(128, 128, 128, .12);
}

[data-bs-theme=light] .code-block-wrapper {
    box-shadow: 0 4px 18px rgba(13, 110, 253, .08), 0 1px 4px rgba(0, 0, 0, .05);
    border-color: rgba(13, 110, 253, .18);
}

/* 头部栏 */
.code-block-header {
    display: flex;
    align-items: center;
    padding: 0 14px;
    height: 40px;
    position: relative;
    background: #1a1f24;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    flex-shrink: 0;
}

[data-bs-theme=light] .code-block-header {
    background: linear-gradient(90deg, #ddeafd 0%, #e8f0fe 60%, #dfe9fd 100%);
    border-bottom: 1px solid rgba(13, 110, 253, .14);
}

/* macOS 交通灯圆点 */
.code-dots {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    z-index: 1;
}

.code-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.code-dot-red { background: #ff5f57; }
.code-dot-yel { background: #febc2e; }
.code-dot-grn { background: #28c840; }

/* 语言标签居中 */
.code-lang-label {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .10em;
    text-transform: uppercase;
    opacity: .45;
    pointer-events: none;
    white-space: nowrap;
}

/* 复制按钮 */
.code-copy-btn-new {
    margin-left: auto;
    padding: 2px 10px;
    font-size: 11px;
    border: 1px solid rgba(128, 128, 128, .28);
    border-radius: 5px;
    background: rgba(128, 128, 128, .10);
    color: inherit;
    cursor: pointer;
    opacity: .6;
    transition: opacity .15s, background .15s, color .15s, border-color .15s;
    z-index: 1;
    flex-shrink: 0;
}

[data-bs-theme=light] .code-copy-btn-new {
    border-color: rgba(13, 110, 253, .30);
    background: rgba(13, 110, 253, .08);
    color: rgba(13, 110, 253, .85);
}

.code-copy-btn-new:hover {
    opacity: 1;
    background: rgba(128, 128, 128, .22);
}

[data-bs-theme=light] .code-copy-btn-new:hover {
    background: rgba(13, 110, 253, .16);
    border-color: rgba(13, 110, 253, .50);
}

.code-copy-btn-new.copied {
    color: #4caf50 !important;
    border-color: #4caf50 !important;
    opacity: 1 !important;
}

/* 代码体 */
#post-content .code-block-wrapper pre {
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: .9rem 1rem .9rem 0 !important;
}

/* 行号 */
.code-block-wrapper code {
    counter-reset: code-line;
    display: block;
}

.code-line {
    display: block;
    padding-left: 3.6em;
    position: relative;
    min-height: 1.5em;
}

.code-line::before {
    counter-increment: code-line;
    content: counter(code-line);
    position: absolute;
    left: 0;
    width: 2.8em;
    text-align: right;
    padding-right: 0.7em;
    color: rgba(128, 128, 128, .32);
    user-select: none;
    pointer-events: none;
    border-right: 1px solid rgba(128, 128, 128, .12);
}

/* ===== 2. 右侧侧栏大纲 ===== */
#toc-sidebar {
    border-radius: var(--bs-border-radius-lg, 8px);
    overflow: hidden;
    border: 1px solid rgba(var(--primary-color-rgba), .15);
}

.toc-sidebar-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    font-size: .82rem;
    font-weight: 600;
    background: rgba(var(--primary-bg-rgba));
    color: rgba(var(--primary-color-rgba));
    border-bottom: 1px solid rgba(var(--primary-color-rgba), .12);
}

#toc-sidebar-content {
    padding: 6px 0;
    max-height: 56vh;
    overflow-y: auto;
    scrollbar-width: thin;
}

#toc-sidebar-content::-webkit-scrollbar {
    width: 3px;
}

#toc-sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(var(--primary-color-rgba), .3);
    border-radius: 2px;
}

.toc-item {
    display: block;
    padding: 4px 14px;
    font-size: .8rem;
    color: rgba(var(--link-color-second-rgba));
    text-decoration: none !important;
    box-shadow: none !important;
    line-height: 1.6;
    border-left: 2px solid transparent;
    transition: color .18s, background .18s, border-color .18s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toc-item:hover {
    color: rgba(var(--primary-color-rgba));
    background: rgba(var(--primary-bg-rgba));
    box-shadow: none !important;
}

.toc-item.active {
    color: rgba(var(--primary-color-rgba)) !important;
    border-left-color: rgba(var(--primary-color-rgba));
    background: rgba(var(--primary-bg-rgba));
    font-weight: 500;
    box-shadow: none !important;
}

/* ===== 2. 文章阅读进度条 ===== */
#reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: rgba(var(--primary-color-rgba));
    z-index: 9999;
    transition: width .1s linear;
    border-radius: 0 2px 2px 0;
}

/* ===== 4. 预计阅读时长 ===== */
.reading-time {
    display: inline;
}

/* ===== 5. 返回顶部按钮 ===== */
#back-to-top {
    position: fixed;
    bottom: 36px;
    right: 36px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(var(--primary-color-rgba));
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .3s ease, transform .3s ease, background .15s;
    z-index: 1050;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}
#back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
}
#back-to-top:hover {
    background: rgba(var(--primary-color-rgba), .8);
}

/* ===== 6. 文章标题锚点链接 ===== */
#post-content .heading-anchor {
    margin-left: 6px;
    font-size: .8em;
    opacity: 0;
    text-decoration: none !important;
    box-shadow: none !important;
    color: rgba(var(--primary-color-rgba)) !important;
    transition: opacity .2s ease;
    vertical-align: middle;
}
#post-content .heading-anchor:hover {
    box-shadow: none !important;
}
#post-content h1:hover .heading-anchor,
#post-content h2:hover .heading-anchor,
#post-content h3:hover .heading-anchor,
#post-content h4:hover .heading-anchor,
#post-content h5:hover .heading-anchor,
#post-content h6:hover .heading-anchor {
    opacity: 1;
}
