h2 {
    font-size: 2.2rem;
    margin: 3rem 0 2rem;
    color: #ffffff;
    position: relative;
    padding-left: 3rem;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1.2;
    text-transform: uppercase;
    text-shadow:
        0 0 10px rgba(79, 109, 245, 0.3),
        0 0 20px rgba(79, 109, 245, 0.2),
        0 2px 5px rgba(0, 0, 0, 0.5);
}

h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 40px;
    background: linear-gradient(to bottom,
            #ff4757 0%,
            #ff6b81 30%,
            #00d2ff 70%,
            #7158e2 100%);
    border-radius: 3px;
    box-shadow:
        0 0 15px rgba(255, 71, 87, 0.8),
        0 0 25px rgba(0, 210, 255, 0.6),
        inset 0 0 10px rgba(255, 255, 255, 0.2);
    animation: h2BarPulse 3s ease-in-out infinite;
    z-index: 1;
}

@keyframes h2BarPulse {

    0%,
    100% {
        box-shadow:
            0 0 15px rgba(255, 71, 87, 0.8),
            0 0 25px rgba(0, 210, 255, 0.6),
            inset 0 0 10px rgba(255, 255, 255, 0.2);
        transform: translateY(-50%) scaleY(1);
    }

    50% {
        box-shadow:
            0 0 25px rgba(255, 71, 87, 1),
            0 0 35px rgba(0, 210, 255, 0.8),
            inset 0 0 15px rgba(255, 255, 255, 0.3);
        transform: translateY(-50%) scaleY(1.15);
    }
}

h2::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 3rem;
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg,
            #ff4757 0%,
            #ff6b81 30%,
            #00d2ff 70%,
            #7158e2 100%);
    border-radius: 2px;
    opacity: 0.9;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.7);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

h2:hover::after {
    width: 120px;
    box-shadow:
        0 0 20px rgba(0, 210, 255, 0.9),
        0 0 30px rgba(255, 71, 87, 0.5);
    background: linear-gradient(90deg,
            #ff4757 0%,
            #00d2ff 50%,
            #7158e2 100%);
}

/* 装饰性背景光晕 */
h2 .glow-effect {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 100px;
    height: 60px;
    background: radial-gradient(circle,
            rgba(79, 109, 245, 0.3) 0%,
            rgba(79, 109, 245, 0.1) 40%,
            transparent 70%);
    filter: blur(10px);
    z-index: 0;
    opacity: 0.5;
    animation: glowFloat 4s ease-in-out infinite;
}

@keyframes glowFloat {

    0%,
    100% {
        transform: translateY(-50%) translateX(0);
        opacity: 0.5;
    }

    50% {
        transform: translateY(-50%) translateX(20px);
        opacity: 0.8;
    }
}

/* 特殊类型的h2 */
h2.page-title {
    font-size: 2.5rem;
    margin: 4rem 0 2.5rem;
    padding-left: 4rem;
    text-align: center;
    background: linear-gradient(90deg,
            #ff4757 0%,
            #ff6b81 25%,
            #00d2ff 50%,
            #7158e2 75%,
            #ff4757 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    background-size: 200% 100%;
    animation: gradientShift 4s linear infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

h2.page-title::before {
    display: none;
}

h2.page-title::after {
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
}

h2.section-title {
    border-bottom: 2px solid rgba(113, 88, 226, 0.4);
    padding-bottom: 1rem;
    margin-bottom: 2.5rem;
}

h2.section-title::after {
    bottom: -2px;
    width: 120px;
    height: 4px;
}

/* 卡片内的h2 */
.card h2,
.content-section h2 {
    margin-top: 0;
    padding-left: 2.5rem;
    margin-bottom: 1.8rem;
}

.card h2::before,
.content-section h2::before {
    width: 5px;
    height: 35px;
}

/* 主标题后的第一个h2 */
h1+h2 {
    margin-top: 2rem;
}

/* 代码块前的h2 */
pre+h2 {
    margin-top: 4rem;
}

/* 装饰性数字前缀 */
h2.with-number {
    counter-increment: section;
    padding-left: 4.5rem;
}

h2.with-number::before {
    content: counter(section, decimal-leading-zero);
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.5rem;
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
    background: linear-gradient(to bottom, #ff4757, #00d2ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    opacity: 0.4;
    width: auto;
    height: auto;
    background: none;
    box-shadow: none;
    animation: none;
}

h2.with-number::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 3.5rem;
    transform: translateY(-50%);
    width: 2px;
    height: 30px;
    background: linear-gradient(to bottom, transparent, #00d2ff, transparent);
}

/* 动画标题 */
h2.animated {
    overflow: hidden;
    padding-right: 2rem;
}

h2.animated .title-text {
    display: inline-block;
    position: relative;
}

h2.animated .title-text::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #00d2ff;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

h2.animated:hover .title-text::after {
    transform: scaleX(1);
}

/* 响应式调整 */
@media (max-width: 768px) {
    h2 {
        font-size: 1.8rem;
        margin: 2.5rem 0 1.5rem;
        padding-left: 2.5rem;
        letter-spacing: 0.5px;
    }

    h2::before {
        width: 5px;
        height: 35px;
    }

    h2::after {
        left: 2.5rem;
        width: 60px;
        bottom: -10px;
    }

    h2:hover::after {
        width: 80px;
    }

    h2.page-title {
        font-size: 2rem;
        padding-left: 0;
        margin: 3rem 0 2rem;
    }

    h2.page-title::after {
        width: 100px;
    }

    h2.with-number {
        padding-left: 3.5rem;
    }

    h2.with-number::before {
        font-size: 2rem;
    }

    h2.with-number::after {
        left: 2.8rem;
    }

    .card h2,
    .content-section h2 {
        padding-left: 2rem;
        font-size: 1.6rem;
    }

    .card h2::before,
    .content-section h2::before {
        width: 4px;
        height: 30px;
    }
}

@media (max-width: 480px) {
    h2 {
        font-size: 1.5rem;
        margin: 2rem 0 1.2rem;
        padding-left: 2rem;
        text-transform: none;
    }

    h2::before {
        width: 4px;
        height: 28px;
    }

    h2::after {
        left: 2rem;
        width: 50px;
        bottom: -8px;
        height: 2px;
    }

    h2:hover::after {
        width: 60px;
    }

    h2.page-title {
        font-size: 1.6rem;
        margin: 2.5rem 0 1.5rem;
    }

    h2.page-title::after {
        width: 80px;
        height: 2px;
    }

    h2.with-number {
        padding-left: 3rem;
    }

    h2.with-number::before {
        font-size: 1.8rem;
    }

    h2.with-number::after {
        left: 2.5rem;
        height: 25px;
    }
}