* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Segoe UI", "Microsoft Yahei", sans-serif;
}

body {
    background-color: #f0f4f8;
    color: #333;
    line-height: 1.6;
}

/* ========== 顶部导航栏 ========== */
header {
    background: #1f4068;
    color: #fff;
    padding: 1.2rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 99;
}
.header-wrap {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo {
    height: 80px;
    width: auto;
    border-radius: 6px;
    flex-shrink: 0;
}

.site-title h1 {
    font-size: 1.6rem;
    letter-spacing: 1px;
}
.author {
    margin-top: 0.2rem;
    font-size: 0.85rem;
    opacity: 0.85;
}

.header-right {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.bilibili-link {
    background: #fb7299;
    color: #fff;
    text-decoration: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    transition: 0.3s;
    font-weight: 500;
}
.bilibili-link:hover {
    background: #f85a87;
    transform: scale(1.05);
}
.github-link {
    background: #24292f;
    color: #fff;
    text-decoration: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    transition: 0.3s;
    font-weight: 500;
}
.github-link:hover {
    background: #373e47;
    transform: scale(1.05);
}

/* ========== 左侧导航栏 ========== */
.side-nav {
    position: fixed;
    left: 15px;
    top: 140px;
    bottom: 20px;
    background: #fff;
    padding: 1.8rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 25px rgba(0,0,0,0.15);
    width: 300px;
    z-index: 98;
    overflow: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease;
    display: flex;
    flex-direction: column;
}
.side-nav.hidden {
    transform: translateX(-280px);
    opacity: 0;
    pointer-events: none;
}
.side-nav h4 {
    color: #1f4068;
    font-size: 1.1rem;
    margin-bottom: 1.2rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid #e8f0fc;
    letter-spacing: 2px;
    flex-shrink: 0;
}
.side-nav ul {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    margin: 0 -0.3rem;
    padding: 0 0.3rem;
}
.side-nav ul::-webkit-scrollbar {
    width: 4px;
}
.side-nav ul::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}
.side-nav ul::-webkit-scrollbar-track {
    background: transparent;
}
.side-nav li {
    margin: 0.4rem 0;
}
.side-nav a.parent-item {
    background-color: #e8f0fc;
    color: #1f4068;
    text-decoration: none;
    padding: 0.5rem 0.8rem;
    display: block;
    border-radius: 6px;
    transition: background 0.2s;
    cursor: pointer;
    font-weight: 500;
}
.side-nav a.parent-item:hover {
    background-color: #d0e1f7;
}
.sub-menu {
    display: none;
    margin-left: 12px;
    border-left: 1px dashed #ccc;
    padding-left: 8px;
}
.sub-menu.open {
    display: block;
}
.sub-menu a {
    background-color: #f7f9fc;
    color: #444;
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    display: block;
    border-radius: 4px;
    transition: background 0.2s;
    cursor: pointer;
    font-size: 0.92rem;
}
.sub-menu a:hover {
    background-color: #e8f0fc;
    color: #1f4068;
}
.side-nav .blog-home-item {
    background-color: #1f4068 !important;
    color: #ffffff !important;
    border: 2px solid #2a5288;
    margin-bottom: 12px;
    font-size: 1rem;
    letter-spacing: 1px;
}
.side-nav .blog-home-item:hover {
    background-color: #2a5288 !important;
}

/* ========== 主内容区 ========== */
.main {
    max-width: 1400px;
    margin: 4rem auto;
    padding: 0 2rem 0 240px;
    transition: padding-left 0.3s ease;
}
.main.full-width {
    padding-left: 2rem;
}
.intro {
    text-align: center;
    margin-bottom: 2rem;
}
.intro h2 {
    font-size: 1.8rem;
    color: #1f4068;
    margin-bottom: 0.8rem;
}
.intro p {
    color: #666;
    font-size: 1.05rem;
}

/* ========== 搜索框样式 ========== */
.search-bar {
    max-width: 500px;
    margin: 0 auto 2.5rem auto;
}
#toolSearchInput {
    width: 100%;
    padding: 12px 20px;
    font-size: 1rem;
    border: 1px solid #dce4ec;
    border-radius: 40px;
    background: #fff;
    outline: none;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
#toolSearchInput:focus {
    border-color: #1f4068;
    box-shadow: 0 0 0 3px rgba(31,64,104,0.2);
}

/* ========== 工具卡片 ========== */
#toolList {
    border-top: 1px solid #dce4ec;
    padding-top: 1rem;
}
.tool-category {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(31, 64, 104, 0.1);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid #e8edf2;
    scroll-margin-top: 140px;
}
.category-title {
    font-size: 1.2rem;
    color: #1f4068;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e8edf2;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.category-icon {
    font-size: 1.6rem;
}
.sub-tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}
.sub-tool-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: #f7f9fc;
    padding: 16px 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #1a4480; 
    min-height: 120px; 
}

.sub-tool-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(31, 64, 104, 0.12);
    border-color: #1f4068;
    background: #fff;
}
.sub-tool-card .icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    //display: flex;
    display: none;
    align-items: center;
    justify-content: center;
}
.sub-tool-card .icon img {
    max-width: 44px;
    max-height: 44px;
    object-fit: contain;
}
.sub-tool-card .icon:not(:has(img)) {
    font-size: 2rem;
}
.sub-tool-card .card-info {
    flex: 1;
    overflow: hidden;
    width: 100%;
}
.sub-tool-card h4 {
    font-size: 1.1rem;
    font-weight: 700;          
    margin: 0 0 6px 0;        
    color: #1f4068;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    min-height: 2.6em;         
    max-height: 2.6em;
    //border-bottom: 3px dashed #1a4480;
    //padding-bottom: 6px;  
}
.sub-tool-card p {
    font-size: 0.9rem;
    color: #6c757d;
    line-height: 1.3;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 3.9em;        
    max-height: 3.9em;
}
/* ========== 响应式适配 ========== */
@media (max-width: 900px) {
    .side-nav {
        display: none;
    }
    .main {
        padding-left: 2rem;
    }
    .toggle-side-btn {
        display: none;
    }
}

@media (max-width: 480px) {
    .header-wrap {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    .header-left {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    .header-logo {
        height: 50px;
    }
    .header-right {
        justify-content: center;
    }
    .sub-tool-grid {
        grid-template-columns: 1fr;
    }
    .sub-tool-card {
        padding: 12px 16px;
        min-height: 80px;
    }
    .sub-tool-card .icon {
        width: 40px;
        height: 40px;
    }
    .sub-tool-card h4 {
        font-size: 0.85rem;
    }
    .sub-tool-card p {
        font-size: 0.7rem;
    }
    .header-logo {
        height: 40px;
    }
}

/* ========== 页脚 ========== */
footer {
    text-align: center;
    padding: 2rem;
    color: #888;
    font-size: 0.9rem;
    background: #fff;
    margin-top: 3rem;
    position: relative;
}
footer .email {
    margin: 0.5rem 0;
}
.donate-wrap {
    display: inline-block;
    position: relative;
    margin-left: 8px;
    cursor: pointer;
    color: #1f4068;
    font-weight: 500;
}
.donate-tip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.2);
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 100;
}
.donate-tip img {
    display: block;
    max-width: 400px;
    height: auto;
}
.donate-wrap:hover .donate-tip {
    visibility: visible;
    opacity: 1;
}
.toggle-side-btn {
    position: fixed;
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: #ffffff;
    color: #1f4068;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.toggle-side-btn:hover {
    background: #f5f7fa;
    transform: translateY(-50%) scale(1.05);
}

.lang-switch-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 0.5rem 1.4rem;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    letter-spacing: 0.5px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.lang-switch-btn:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.6);
    background: linear-gradient(135deg, #5a6fd6 0%, #6a3f8f 100%);
}
.lang-switch-btn:active {
    transform: scale(0.97);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}