@import "./styles.css";


/* ==========================================
   现代化设计系统 - 毛玻璃效果 (Glassmorphism)
   ========================================== */

:root {
    --h-title-color: #3948d2;
    --h-title-color-rgb: 57, 72, 210;
    --accent-purple: #9f1ae2;
    --accent-purple-rgb: 159, 26, 226;

    /* 毛玻璃效果变量 */
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-bg-light: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-blur: 20px;
    --glass-blur-light: 12px;

    /* 阴影系统 */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 8px 32px rgba(var(--h-title-color-rgb), 0.12);
    --shadow-lg: 0 16px 48px rgba(var(--h-title-color-rgb), 0.18);
    --shadow-glow: 0 0 40px rgba(var(--h-title-color-rgb), 0.15);

    /* 过渡动画 */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    /* 亮色主题额外变量 */
    --bg-primary: #f8f9ff;
    --bg-secondary: #eef2ff;
    --text-primary: #1a1a2e;
    --text-secondary: #555;
}

/* 暗色模式变量 */
[data-theme="dark"] {
    --h-title-color: #6d7ce5;
    --h-title-color-rgb: 109, 124, 229;
    --accent-purple: #b84de8;
    --accent-purple-rgb: 184, 77, 232;

    --glass-bg: rgba(30, 30, 50, 0.85);
    --glass-bg-light: rgba(40, 40, 65, 0.7);
    --glass-border: rgba(100, 100, 150, 0.3);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(var(--h-title-color-rgb), 0.25);

    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --text-primary: #e8e8f0;
    --text-secondary: #aaa;
}

/* 主题过渡 */
body {
    transition: background-color 0.4s ease, color 0.4s ease;
}

[data-theme="dark"] body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

[data-theme="dark"] .bg-gradient-primary-to-secondary-light,
[data-theme="dark"] .bg-gradient-primary-to-secondary-gray,
[data-theme="dark"] .bg-gradient-primary-to-secondary-dark {
    background: linear-gradient(135deg, #1a1a2e 0%, #16162a 50%, #1e1e35 100%) !important;
}

[data-theme="dark"] .main-body {
    color: var(--text-primary);
}

[data-theme="dark"] .main-body h3,
[data-theme="dark"] .main-body h4 {
    color: var(--h-title-color);
}

[data-theme="dark"] .main-body a:not([class]) {
    color: var(--h-title-color);
}

[data-theme="dark"] .toc-sidebar {
    background: var(--glass-bg);
}

[data-theme="dark"] .toc-title {
    background: linear-gradient(var(--bg-secondary), var(--bg-secondary)) padding-box,
        linear-gradient(90deg, var(--h-title-color), var(--accent-purple)) border-box;
}

[data-theme="dark"] #toc-nav a {
    color: var(--text-secondary);
}

[data-theme="dark"] #toc-nav a:hover {
    color: var(--h-title-color);
    background: rgba(var(--h-title-color-rgb), 0.15);
}

[data-theme="dark"] .main-body table {
    background: var(--glass-bg);
}

[data-theme="dark"] .main-body code {
    background: linear-gradient(135deg,
            rgba(var(--h-title-color-rgb), 0.15) 0%,
            rgba(var(--accent-purple-rgb), 0.15) 100%);
}


/* ==========================================
   导航栏 - 毛玻璃效果 + 滚动增强
   ========================================== */

.header {
    background: linear-gradient(135deg,
            rgba(235, 238, 255, 0.95) 0%,
            rgba(225, 230, 255, 0.95) 50%,
            rgba(235, 225, 250, 0.95) 100%);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid rgba(var(--h-title-color-rgb), 0.2);
    box-shadow: var(--shadow-sm),
        inset 0 -1px 0 rgba(var(--h-title-color-rgb), 0.08);
    z-index: 10000;
    transition: all var(--transition-normal);
}

/* 导航栏滚动后变化 */
.header.scrolled {
    background: linear-gradient(135deg,
            rgba(220, 225, 255, 0.98) 0%,
            rgba(210, 218, 255, 0.98) 50%,
            rgba(225, 215, 250, 0.98) 100%);
    box-shadow: var(--shadow-md),
        inset 0 -1px 0 rgba(var(--h-title-color-rgb), 0.12);
}

/* 导航栏底部渐变装饰线 */
.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
            transparent 0%,
            var(--h-title-color) 15%,
            var(--accent-purple) 85%,
            transparent 100%);
    opacity: 0.8;
    transition: opacity var(--transition-normal);
}

.header:hover {
    background: linear-gradient(135deg,
            rgba(230, 235, 255, 0.98) 0%,
            rgba(220, 225, 255, 0.98) 50%,
            rgba(230, 220, 250, 0.98) 100%);
    box-shadow: var(--shadow-md);
}

.header:hover::after {
    opacity: 1;
}

.header .navbar-brand {
    transition: transform var(--transition-fast), text-shadow var(--transition-fast);
    position: relative;
}

.header .navbar-brand:hover {
    transform: scale(1.02);
    text-shadow: 0 0 20px rgba(var(--h-title-color-rgb), 0.4);
}

/* 品牌名称光晕效果 */
.header .navbar-brand::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120%;
    height: 150%;
    background: radial-gradient(ellipse, rgba(var(--h-title-color-rgb), 0.15) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity var(--transition-normal);
    pointer-events: none;
}

.header .navbar-brand:hover::before {
    opacity: 1;
}

.header .nav-link {
    position: relative;
    transition: color var(--transition-fast), transform var(--transition-fast);
    font-weight: 500;
}

.header .nav-link:hover {
    transform: translateY(-2px);
}

.header .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--h-title-color), var(--accent-purple));
    transition: width var(--transition-normal), left var(--transition-normal);
    border-radius: 2px;
}

.header .nav-link:hover::after {
    width: 80%;
    left: 10%;
}


/* ==========================================
   Footer - 渐变毛玻璃效果 + 波浪分隔线
   ========================================== */

.bg-bottom {
    background: linear-gradient(135deg,
            rgba(var(--h-title-color-rgb), 0.95) 0%,
            rgba(var(--accent-purple-rgb), 0.9) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    margin-top: 60px;
}

/* 波浪分隔线 */
.bg-bottom::before {
    content: '';
    position: absolute;
    top: -50px;
    left: 0;
    right: 0;
    height: 60px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 100' preserveAspectRatio='none'%3E%3Cpath fill='%233948d2' fill-opacity='0.9' d='M0,40 C360,100 1080,0 1440,60 L1440,100 L0,100 Z'%3E%3C/path%3E%3C/svg%3E") no-repeat center;
    background-size: 100% 100%;
    pointer-events: none;
}

/* 装饰性光斑 */
.bg-bottom::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(255, 255, 255, 0.08) 0%, transparent 40%);
    pointer-events: none;
}

/* Footer 链接动效 */
.bg-bottom a {
    position: relative;
    transition: all var(--transition-fast);
    display: inline-block;
}

.bg-bottom a:hover {
    transform: translateY(-2px);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}


/* ==========================================
   顶部横幅区域 - 动态增强
   ========================================== */

.top-section {
    position: relative;
    padding: 10rem 0;
    background-position: center;
    background-size: cover;
    height: 25rem;
    overflow: hidden;
}

.top-section h2 {
    font-weight: 400;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3),
        0 0 40px rgba(var(--h-title-color-rgb), 0.3);
    animation: fadeIn 1.2s ease-out, floatSubtle 4s ease-in-out infinite;
    animation-delay: 0s, 1.2s;
}

.top-section .top-section-content {
    position: relative;
    z-index: 1;
}

/* 渐变遮罩呼吸效果 */
.top-section:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg,
            rgba(0, 0, 0, 0.25) 0%,
            rgba(var(--h-title-color-rgb), 0.15) 50%,
            rgba(0, 0, 0, 0.55) 100%);
    animation: gradientBreath 8s ease-in-out infinite;
    background-size: 100% 200%;
}

/* 装饰性光斑 */
.top-section::after {
    content: '';
    position: absolute;
    top: 20%;
    right: 10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(var(--accent-purple-rgb), 0.2) 0%, transparent 70%);
    animation: float 6s ease-in-out infinite;
    pointer-events: none;
}


/* ==========================================
   Section 标题样式
   ========================================== */

section header h2 {
    font-family: "Kanit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" !important;
    color: var(--h-title-color);
    font-size: 2.3rem;
    line-height: 4rem;
    position: relative;
    display: inline-block;
}

section header h2 i {
    background: linear-gradient(135deg, var(--h-title-color), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

section .main-body {
    font-size: 1.3rem;
    font-weight: 200;
    line-height: 2.4rem;
}


/* ==========================================
   目录侧边栏 - 毛玻璃卡片 + 连接线装饰
   ========================================== */

.toc-sidebar {
    position: sticky;
    top: 100px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    padding: 24px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    transition: all var(--transition-normal);
    animation: slideRight 0.6s ease-out;
}

.toc-sidebar:hover {
    box-shadow: var(--shadow-lg), 0 0 30px rgba(var(--h-title-color-rgb), 0.1);
    transform: translateY(-3px);
}

/* 自定义滚动条 */
.toc-sidebar::-webkit-scrollbar {
    width: 4px;
}

.toc-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.toc-sidebar::-webkit-scrollbar-thumb {
    background: rgba(var(--h-title-color-rgb), 0.3);
    border-radius: 4px;
}

.toc-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--h-title-color-rgb), 0.5);
}

.toc-title {
    color: var(--h-title-color);
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid transparent;
    background: linear-gradient(white, white) padding-box,
        linear-gradient(90deg, var(--h-title-color), var(--accent-purple)) border-box;
    border-image-slice: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toc-title::before {
    content: '📑';
    font-size: 1.1em;
}

#toc-nav {
    padding-left: 0;
    list-style: none;
    position: relative;
}

/* 连接线 */
#toc-nav::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background: linear-gradient(180deg,
            rgba(var(--h-title-color-rgb), 0.15) 0%,
            rgba(var(--accent-purple-rgb), 0.15) 100%);
    border-radius: 2px;
}

#toc-nav ul {
    padding-left: 20px;
    list-style: none;
}

#toc-nav li {
    margin: 8px 0;
    position: relative;
}

/* 连接线节点 */
#toc-nav li::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(var(--h-title-color-rgb), 0.2);
    transform: translateY(-50%);
    transition: all var(--transition-fast);
}

#toc-nav a {
    color: #555;
    text-decoration: none;
    font-size: 0.95rem;
    display: block;
    padding: 10px 14px;
    border-radius: 10px;
    position: relative;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
    margin-left: 4px;
}

#toc-nav a:hover {
    color: var(--h-title-color);
    background: rgba(var(--h-title-color-rgb), 0.08);
    border-left-color: var(--h-title-color);
    padding-left: 18px;
}

#toc-nav li:hover::before {
    background: var(--h-title-color);
    transform: translateY(-50%) scale(1.3);
}

#toc-nav a.active {
    color: #fff;
    background: linear-gradient(135deg, var(--h-title-color), var(--accent-purple));
    border-left-color: transparent;
    box-shadow: 0 4px 18px rgba(var(--h-title-color-rgb), 0.35);
    font-weight: 500;
}

#toc-nav li:has(a.active)::before {
    background: linear-gradient(135deg, var(--h-title-color), var(--accent-purple));
    transform: translateY(-50%) scale(1.5);
    box-shadow: 0 0 10px rgba(var(--h-title-color-rgb), 0.5);
}

@media screen and (max-width: 991px) {
    .toc-sidebar {
        position: static;
        max-height: none;
        margin-bottom: 24px;
        animation: slideUp 0.5s ease-out;
    }

    #toc-nav::before {
        display: none;
    }

    #toc-nav li::before {
        display: none;
    }

    #toc-nav a {
        margin-left: 0;
    }
}


/* ==========================================
   渐变背景 - Section 样式
   ========================================== */

.bg-gradient-primary-to-secondary-light {
    background: linear-gradient(135deg, #eef2ff 0%, #e8ecff 50%, #f0f4ff 100%) !important;
    position: relative;
}

.bg-gradient-primary-to-secondary-light::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 30% 20%, rgba(var(--h-title-color-rgb), 0.06) 0%, transparent 50%);
    pointer-events: none;
}

.bg-gradient-primary-to-secondary-gray {
    background: linear-gradient(135deg, #e8eaf5 0%, #dfe3f0 50%, #e5e8f2 100%) !important;
}

.bg-gradient-primary-to-secondary-dark {
    background: linear-gradient(135deg, #e5eaff 0%, #dce2ff 50%, #e8e5f8 100%) !important;
    position: relative;
}

.bg-gradient-primary-to-secondary-dark::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 70% 80%, rgba(var(--accent-purple-rgb), 0.05) 0%, transparent 50%);
    pointer-events: none;
}


/* ==========================================
   通用层级样式
   ========================================== */

.on-top {
    position: relative;
    z-index: 10000;
}

.top-bg {
    background-position: center;
    background-size: fill;
    width: 100%;
    height: 100%;
}

.top-bg::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
}


/* ==========================================
   头像 - 增强的视觉效果
   ========================================== */

#avatar {
    position: relative;
    height: 0;
    top: min(-65px, max(-100px, calc(-1*100vw/12)));
    max-width: 55em;
    margin: 0 1.5rem 0 0;
    float: right;
    z-index: 9000;
}

/* 头像容器 - 渐变边框 */
#avatar img {
    height: max(130px, min(200px, calc(100vw/6)));
    border-radius: 16px;
    border: 4px solid transparent;
    background:
        linear-gradient(white, white) padding-box,
        linear-gradient(135deg, var(--h-title-color), var(--accent-purple)) border-box;
    box-shadow: 0 10px 40px rgba(var(--h-title-color-rgb), 0.3),
        0 0 20px rgba(var(--h-title-color-rgb), 0.15);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow var(--transition-slow),
        border-color var(--transition-normal);
    animation: scaleIn 0.8s ease-out;
}

/* 头像悬浮 - 3D倾斜效果 */
#avatar img:hover {
    transform: translateY(-12px) scale(1.05) rotateX(5deg) rotateY(-5deg);
    box-shadow: 0 25px 60px rgba(var(--h-title-color-rgb), 0.4),
        0 0 30px rgba(var(--h-title-color-rgb), 0.3),
        0 0 60px rgba(var(--accent-purple-rgb), 0.25);
}

/* 头像外层光环 */
#avatar::before {
    content: '';
    position: absolute;
    top: -8px;
    right: -8px;
    width: calc(max(130px, min(200px, calc(100vw/6))) + 16px);
    height: calc(max(130px, min(200px, calc(100vw/6))) + 16px);
    border-radius: 20px;
    background: linear-gradient(135deg,
            rgba(var(--h-title-color-rgb), 0.25) 0%,
            rgba(var(--accent-purple-rgb), 0.25) 100%);
    filter: blur(8px);
    z-index: -1;
    animation: pulseGlow 3s ease-in-out infinite;
}

@media screen and (max-width: 991px) {
    #avatar {
        margin: 0;
    }

    #avatar::before {
        display: none;
    }
}


/* ==========================================
   语言切换按钮 - 毛玻璃效果
   ========================================== */

.language-switcher {
    display: flex;
    gap: 8px;
    align-items: center;
}

.lang-btn {
    padding: 8px 18px;
    border: 1px solid rgba(var(--h-title-color-rgb), 0.3);
    background: var(--glass-bg-light);
    backdrop-filter: blur(var(--glass-blur-light));
    -webkit-backdrop-filter: blur(var(--glass-blur-light));
    color: var(--h-title-color);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 24px;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.lang-btn:hover {
    background: rgba(var(--h-title-color-rgb), 0.1);
    border-color: var(--h-title-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.lang-btn.active {
    background: linear-gradient(135deg, var(--h-title-color), var(--accent-purple));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 20px rgba(var(--h-title-color-rgb), 0.4);
}

.lang-btn.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(var(--h-title-color-rgb), 0.5);
}

@media screen and (max-width: 576px) {
    .language-switcher {
        flex-direction: column;
        gap: 4px;
    }

    .lang-btn {
        padding: 6px 14px;
        font-size: 0.8rem;
    }
}


/* ==========================================
   卡片和内容通用样式
   ========================================== */

.main-body h3,
.main-body h4 {
    position: relative;
    transition: color var(--transition-fast);
}

.main-body a {
    position: relative;
    transition: color var(--transition-fast);
}

.main-body a:hover {
    color: var(--accent-purple);
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 选中文本颜色 */
::selection {
    background: rgba(var(--h-title-color-rgb), 0.2);
    color: var(--h-title-color);
}


/* ==========================================
   全局语言切换器
   ========================================== */

.language-switcher {
    display: flex;
    gap: 8px;
}

.navbar-lang-switcher {
    margin-left: 16px;
}

.lang-btn {
    padding: 6px 16px;
    border: 1px solid rgba(var(--h-title-color-rgb), 0.2);
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #666;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.lang-btn:hover {
    color: var(--h-title-color);
    border-color: var(--h-title-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.lang-btn.active {
    background: linear-gradient(135deg, var(--h-title-color), var(--accent-purple));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(var(--h-title-color-rgb), 0.3);
}


/* ==========================================
   语言内容切换
   ========================================== */

/* 默认隐藏英文内容 */
.lang-en {
    display: none;
}

.lang-zh {
    display: block;
}

/* 响应式调整 */
@media screen and (max-width: 991px) {
    .navbar-lang-switcher {
        margin-left: 0;
        margin-top: 16px;
        justify-content: center;
    }
}


/* ==========================================
   徽章悬浮动效 (Shields.io badges)
   ========================================== */

.main-body img[src*="shields.io"],
.main-body img[src*="badge"] {
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    border-radius: 4px;
}

.main-body img[src*="shields.io"]:hover,
.main-body img[src*="badge"]:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(var(--h-title-color-rgb), 0.25);
}

/* 徽章链接间距 */
.main-body p>a>img[src*="shields.io"],
.main-body p>a>img[src*="badge"] {
    margin-right: 8px;
    margin-bottom: 8px;
}


/* ==========================================
   表格美化
   ========================================== */

.main-body table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin: 1.5rem 0;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.main-body thead {
    background: linear-gradient(135deg, var(--h-title-color), var(--accent-purple));
    color: white;
}

.main-body th {
    padding: 14px 16px;
    font-weight: 600;
    text-align: left;
}

.main-body td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(var(--h-title-color-rgb), 0.1);
}

.main-body tbody tr {
    transition: background var(--transition-fast);
}

.main-body tbody tr:hover {
    background: rgba(var(--h-title-color-rgb), 0.05);
}

.main-body tbody tr:last-child td {
    border-bottom: none;
}


/* ==========================================
   代码块美化
   ========================================== */

.main-body code {
    background: linear-gradient(135deg,
            rgba(var(--h-title-color-rgb), 0.08) 0%,
            rgba(var(--accent-purple-rgb), 0.08) 100%);
    color: var(--h-title-color);
    padding: 3px 8px;
    border-radius: 6px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9em;
    transition: background var(--transition-fast);
}

.main-body code:hover {
    background: linear-gradient(135deg,
            rgba(var(--h-title-color-rgb), 0.12) 0%,
            rgba(var(--accent-purple-rgb), 0.12) 100%);
}

.main-body pre {
    background: linear-gradient(135deg, #1e1e2e 0%, #2d2d44 100%);
    border-radius: 12px;
    padding: 20px;
    overflow-x: auto;
    box-shadow: var(--shadow-md);
}

.main-body pre code {
    background: none;
    color: #e0e0e0;
    padding: 0;
}


/* ==========================================
   列表样式增强
   ========================================== */

.main-body ul {
    list-style: none;
    padding-left: 0;
}

.main-body ul li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 10px;
}

.main-body ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, var(--h-title-color), var(--accent-purple));
    border-radius: 50%;
}

.main-body ol {
    counter-reset: item;
    padding-left: 0;
}

.main-body ol li {
    counter-increment: item;
    position: relative;
    padding-left: 36px;
    margin-bottom: 10px;
}

.main-body ol li::before {
    content: counter(item);
    position: absolute;
    left: 0;
    top: 2px;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--h-title-color), var(--accent-purple));
    color: white;
    border-radius: 50%;
    font-size: 0.8em;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* ==========================================
   链接样式增强
   ========================================== */

.main-body a:not([class]) {
    color: var(--h-title-color);
    text-decoration: none;
    position: relative;
    transition: color var(--transition-fast);
}

.main-body a:not([class])::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--h-title-color), var(--accent-purple));
    transition: width var(--transition-normal);
    border-radius: 2px;
}

.main-body a:not([class]):hover::after {
    width: 100%;
}

.main-body a:not([class]):hover {
    color: var(--accent-purple);
}


/* ==========================================
   标题装饰增强
   ========================================== */

.main-body h3 {
    position: relative;
    padding-left: 16px;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.main-body h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--h-title-color), var(--accent-purple));
    border-radius: 4px;
}

.main-body h4 {
    color: var(--h-title-color);
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
}


/* ==========================================
   回到顶部按钮
   ========================================== */

.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--h-title-color), var(--accent-purple));
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all var(--transition-normal);
    box-shadow: 0 4px 20px rgba(var(--h-title-color-rgb), 0.4);
    z-index: 9999;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(var(--h-title-color-rgb), 0.5);
}

.back-to-top:active {
    transform: translateY(-2px);
}


/* ==========================================
   主题切换器
   ========================================== */

.theme-toggle {
    position: fixed;
    bottom: 90px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
    z-index: 9999;
    color: var(--h-title-color);
}

.theme-toggle:hover {
    transform: translateY(-3px) rotate(15deg);
    box-shadow: var(--shadow-lg);
}

.theme-toggle .sun-icon {
    display: block;
}

.theme-toggle .moon-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: block;
}

[data-theme="dark"] .theme-toggle {
    background: rgba(30, 30, 50, 0.9);
    color: #ffd93d;
}


/* ==========================================
   粒子背景容器
   ========================================== */

.particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: particleFloat 15s infinite linear;
}

@keyframes particleFloat {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(-100vh) rotate(720deg);
        opacity: 0;
    }
}


/* ==========================================
   打字机效果
   ========================================== */

.typewriter {
    overflow: hidden;
    white-space: nowrap;
    border-right: 3px solid rgba(255, 255, 255, 0.8);
    animation: blink-caret 0.75s step-end infinite;
}

@keyframes blink-caret {

    from,
    to {
        border-color: transparent;
    }

    50% {
        border-color: rgba(255, 255, 255, 0.8);
    }
}

.typewriter.typing-done {
    border-right: none;
    animation: none;
}


/* ==========================================
   暗色模式下的导航栏
   ========================================== */

[data-theme="dark"] .header {
    background: linear-gradient(135deg,
            rgba(25, 25, 45, 0.95) 0%,
            rgba(30, 30, 55, 0.95) 50%,
            rgba(35, 30, 50, 0.95) 100%);
    border-bottom: 1px solid rgba(var(--h-title-color-rgb), 0.3);
}

[data-theme="dark"] .header.scrolled {
    background: linear-gradient(135deg,
            rgba(20, 20, 40, 0.98) 0%,
            rgba(25, 25, 50, 0.98) 50%,
            rgba(30, 25, 45, 0.98) 100%);
}

[data-theme="dark"] .navbar-brand,
[data-theme="dark"] .nav-link {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .nav-link:hover {
    color: var(--h-title-color) !important;
}

[data-theme="dark"] .lang-btn {
    background: transparent;
    border-color: rgba(var(--h-title-color-rgb), 0.4);
    color: var(--text-secondary);
}

[data-theme="dark"] .lang-btn:hover {
    border-color: var(--h-title-color);
    color: var(--h-title-color);
}

[data-theme="dark"] .lang-btn.active {
    background: linear-gradient(135deg, var(--h-title-color), var(--accent-purple));
    color: #fff;
}


/* ==========================================
   UI/UX Pro Max 补充样式
   ========================================== */

/* 1. 全局滚动条美化 */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
}

::-webkit-scrollbar-thumb {
    background: rgba(var(--h-title-color-rgb), 0.25);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: content-box;
    transition: background 0.3s;
}

::-webkit-scrollbar-thumb:hover {
    background-color: rgba(var(--h-title-color-rgb), 0.5);
}

/* 2. 增强文本选中效果 - 提高可见性 */
::-moz-selection {
    background: rgba(var(--h-title-color-rgb), 0.4);
    color: var(--h-title-color);
    text-shadow: none;
}

::selection {
    background: rgba(var(--h-title-color-rgb), 0.4);
    color: var(--h-title-color);
    text-shadow: none;
}

/* 3. 玻璃态引用块 (Blockquote) */
.main-body blockquote {
    background: linear-gradient(135deg, rgba(var(--h-title-color-rgb), 0.05), rgba(var(--accent-purple-rgb), 0.05));
    border-left: 4px solid var(--accent-purple);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 0 16px 16px 0;
    font-size: 1.1rem;
    font-style: italic;
    color: var(--text-secondary);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    position: relative;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.main-body blockquote::before {
    content: '"';
    position: absolute;
    top: -10px;
    left: 10px;
    font-size: 4rem;
    color: rgba(var(--h-title-color-rgb), 0.1);
    font-family: serif;
    line-height: 1;
}

/* 4. 渐变分割线 (HR) */
.main-body hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(var(--h-title-color-rgb), 0.3) 20%,
            rgba(var(--accent-purple-rgb), 0.5) 50%,
            rgba(var(--h-title-color-rgb), 0.3) 80%,
            transparent 100%);
    margin: 3rem 0;
    opacity: 1;
}

/* 5. 图片展示增强 (Markdown图片) */
/* 排除 shields.io 和 badge 图片，避免它们垂直排列 */
.main-body img:not(.emoji):not([class]):not([src*="shields.io"]):not([src*="badge"]) {
    max-width: 100%;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
    display: block;
    margin: 2rem auto;
}

.main-body img:not(.emoji):not([class]):not([src*="shields.io"]):not([src*="badge"]):hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

/* 6. 更新 H3 标题样式 (更精致的标记) */
.main-body h3 {
    position: relative;
    padding-left: 24px;
    margin-top: 3.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
}

.main-body h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 28px;
    background: linear-gradient(to bottom, var(--h-title-color), var(--accent-purple));
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(var(--h-title-color-rgb), 0.3);
}

/* 7. 增强卡片悬停效果 (Glass Card) */
/* 使用 animations.css 中的 .glass-card, 这里无需额外定义，但确保 dark mode 适配 */
[data-theme="dark"] .glass-card {
    background: rgba(30, 30, 50, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
}


/* ==========================================
   移动端响应式修复
   ========================================== */

/* 1. 防止页面横向溢出 */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

/* 2. 表格移动端横向滚动 */
@media screen and (max-width: 768px) {
    .main-body table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 0.9rem;
    }

    .main-body table thead,
    .main-body table tbody,
    .main-body table tr {
        display: table;
        width: 100%;
        table-layout: fixed;
    }

    /* 表格单元格文字换行 */
    .main-body th,
    .main-body td {
        padding: 10px 8px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* 宽表格强制横向滚动 */
    .main-body table {
        min-width: 100%;
    }
}

/* 3. 打字机效果移动端优化 */
@media screen and (max-width: 576px) {
    .typewriter {
        white-space: normal;
        word-wrap: break-word;
        border-right: none;
        animation: none;
        font-size: calc(1.2rem + 2vw);
        line-height: 1.4;
        text-align: center;
    }

    .top-section h2 {
        font-size: calc(1.2rem + 2.5vw);
        padding: 0 1rem;
    }

    .top-section {
        height: auto;
        min-height: 15rem;
        padding: 6rem 0 4rem;
        display: flex;
        align-items: center;
    }
}

/* 4. 头像移动端优化 */
@media screen and (max-width: 576px) {
    #avatar {
        position: relative !important;
        top: auto !important;
        float: none !important;
        height: auto !important;
        display: block;
        text-align: center;
        margin: -60px auto 20px auto;
        max-width: 100%;
    }

    #avatar img {
        height: 120px;
        width: 120px;
        object-fit: cover;
        display: inline-block;
    }
}

/* 5. 回到顶部和主题切换按钮移动端位置 */
@media screen and (max-width: 576px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
    }

    .theme-toggle {
        bottom: 75px;
        right: 20px;
        width: 44px;
        height: 44px;
    }
}

/* 6. Section padding 移动端优化 */
@media screen and (max-width: 576px) {
    section {
        padding: 2rem 0;
    }

    section header h2 {
        font-size: 1.6rem;
        line-height: 2.5rem;
    }

    section .main-body {
        font-size: 1.1rem;
        line-height: 2rem;
    }
}

/* 7. 代码块移动端优化 */
@media screen and (max-width: 576px) {
    .main-body code {
        font-size: 0.8em;
        padding: 2px 6px;
        word-break: break-all;
    }

    .main-body pre {
        padding: 12px;
        font-size: 0.85em;
    }
}

/* 8. Footer 移动端优化 */
@media screen and (max-width: 576px) {
    .bg-bottom {
        margin-top: 40px;
    }

    .bg-bottom::before {
        top: -30px;
        height: 40px;
    }
}

/* 9. TOC目录移动端优化 */
@media screen and (max-width: 576px) {
    .toc-sidebar {
        padding: 16px;
        border-radius: 14px;
    }

    .toc-title {
        font-size: 1rem;
        margin-bottom: 12px;
        padding-bottom: 10px;
    }

    #toc-nav a {
        font-size: 0.85rem;
        padding: 8px 10px;
    }
}

/* 10. 邮箱链接移动端换行 */
@media screen and (max-width: 576px) {
    .main-body p code {
        display: inline-block;
        margin: 4px 0;
    }
}

/* 11. 长链接和长文本换行处理 */
.main-body a {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-all;
}

@media screen and (max-width: 768px) {

    /* 所有文本元素允许换行 */
    .main-body,
    .main-body * {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* 长链接强制换行 */
    .main-body a {
        word-break: break-all;
        max-width: 100%;
    }

    /* 段落内容不溢出 */
    .main-body p {
        max-width: 100%;
        overflow-wrap: break-word;
    }
}