:root {
    --primary: #3B82F6;
    --primary-light: #60A5FA;
    --primary-dark: #2563EB;
    --secondary: #10B981;
    --secondary-light: #34D399;
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #e4eaf1 100%);
    --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --card-shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --text-dark: #1E293B;
    --text-light: #64748B;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-dark);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    padding: 2rem;
}



/* 搜索与分类样式 */
.search-bar {
    display: flex;
    gap: 0.8rem;
    max-width: 600px;
    margin: 1.5rem auto 2rem;
    position: relative;
    z-index: 1;
    transform: translateY(5px);
    animation: slideUp 0.5s ease forwards;
}

@keyframes slideUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#toolSearch {
    flex: 1;
    padding: 0.95rem 1.5rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 2rem;
    background: rgba(255, 255, 255, 0.95);
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
}

#toolSearch:focus {
    border-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
    background: white;
}

#toolSearch::placeholder {
    color: var(--text-light);
    opacity: 0.9;
    font-style: italic;
    letter-spacing: 0.5px;
}

.search-btn {
    background: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.search-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.search-btn:hover::before {
    width: 100px;
    height: 100px;
}

.search-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    background: white;
}

.search-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.category-filter {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
    margin-top: 0.5rem;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
    padding: 0 1rem;
    opacity: 0;
    transform: translateY(10px);
    animation: slideUp 0.5s ease 0.2s forwards;
}

.category-btn {
    padding: 0.65rem 1.3rem;
    border-radius: 2rem;
    background: rgba(255, 255, 255, 0.25);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.category-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.category-btn:hover::before {
    left: 100%;
}

.category-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.category-btn.active {
    background: white;
    color: var(--primary-dark);
    border-color: white;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    font-weight: 700;
    transform: translateY(-2px);
}

.category-btn:active:not(.active) {
    transform: translateY(0) scale(0.98);
}

/* 统一动画声明 */
@keyframes elementFade {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* 为按钮添加脉动动画 */
@keyframes pulse-light {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    }
    50% {
        box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
    }
}

.page-loader {
    animation: elementFade 0.8s forwards 0.3s;
}

.main-header {
    background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
    color: white;
    padding: 2.5rem 1.5rem;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
    border-radius: 0 0 3rem 3rem;
}
/* 完整的main-header样式定义 */
.main-header {
    /* 丰富的背景效果 */
    background: linear-gradient(135deg, 
        #3B82F6 0%, 
        #2563EB 40%, 
        #1D4ED8 100%);
    background-image: 
        /* 粉色装饰效果 */
        radial-gradient(circle at 50% 50%, 
            rgba(236, 72, 153, 0.3) 0%, 
            transparent 70%),
        /* 黄色点缀效果 */
        radial-gradient(circle at 20% 70%, 
            rgba(251, 191, 36, 0.2) 0%, 
            transparent 50%),
        /* 主渐变 */
        linear-gradient(135deg, 
            #3B82F6 0%, 
            #2563EB 40%, 
            #1D4ED8 100%);
    
    color: white;
    padding: 2.5rem 1.5rem;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
    border-radius: 0 0 3rem 3rem;
    transition: all 0.5s ease;
}

/* 左侧装饰元素 */
.main-header::before {
    content: '';
    position: absolute;
    top: -20%;
    left: -10%;
    width: 40%;
    height: 80%;
    background: radial-gradient(circle, 
        rgba(59, 130, 246, 0.4) 0%, 
        rgba(29, 78, 216, 0.2) 70%);
    border-radius: 50%;
    filter: blur(40px);
    z-index: 0;
    animation: float 8s ease-in-out infinite;
}

/* 右侧装饰元素 */
.main-header::after {
    content: '';
    position: absolute;
    bottom: -10%;
    right: -10%;
    width: 30%;
    height: 60%;
    background: radial-gradient(circle, 
        rgba(16, 185, 129, 0.3) 0%, 
        rgba(59, 130, 246, 0.1) 70%);
    border-radius: 50%;
    filter: blur(40px);
    z-index: 0;
    animation: float 6s ease-in-out infinite reverse;
}

/* 中心光效元素 */
.main-header {
    position: relative;
}

/* 文本和内容样式 */
.main-header h1 {
    font-size: clamp(2.5rem, 8vw, 4rem);
    margin-bottom: 0.8rem;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
    color: white;
    font-weight: 800;
    letter-spacing: -0.5px;
    text-align: center;
    transition: all 0.3s ease;
}

.main-header p {
    font-size: clamp(1.1rem, 3vw, 1.35rem);
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto 1.5rem;
    text-align: center;
    position: relative;
    z-index: 1;
    color: white;
    font-weight: 500;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 增强交互效果 */
.main-header:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .main-header {
        padding: 2.5rem 1rem;
        border-radius: 0 0 2rem 2rem;
    }
    
    .main-header h1 {
        font-size: clamp(2rem, 10vw, 3rem);
    }
}

.main-header::before {
    top: -20%;
    right: -10%;
    width: 40%;
    height: 80%;
    animation: float 8s ease-in-out infinite;
}

.main-header::after {
    bottom: -10%;
    left: -10%;
    width: 30%;
    height: 60%;
    animation: float 6s ease-in-out infinite reverse;
}

.main-header::nth-child(3) {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 25%;
    height: 50%;
    animation: float 10s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(10%, 10%) scale(1.1);
    }
}

.main-header h1 {
    font-size: clamp(2.2rem, 6vw, 3.8rem);
    margin-bottom: 0.8rem;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
    color: white;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.main-header p {
    font-size: clamp(1rem, 2vw, 1.25rem);
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto 1.5rem;
    position: relative;
    z-index: 1;
    font-weight: 300;
    letter-spacing: 0.5px;
}

#toolCounter {
    font-weight: bold;
    background: rgba(255, 255, 255, 0.25);
    padding: 0.25rem 1rem;
    border-radius: 20px;
    margin: 0 0.3rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#toolCounter:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

/* 工具网格样式 */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.8rem;
    padding: 4rem 5%;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* 工具卡片样式 */
.tool-card {
    background: white;
    border-radius: 1rem;
    padding: 2.2rem 1.8rem;
    text-align: center;
    cursor: pointer;
    box-shadow: var(--card-shadow);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 260px;
    justify-content: center;
}

/* 响应式布局优化 */
@media (max-width: 1200px) {
    .tool-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }
}

@media (max-width: 992px) {
    .tool-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
        padding: 3rem 5%;
    }
}

@media (max-width: 768px) {
    .tool-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.2rem;
        padding: 2.5rem 4%;
    }
    
    .tool-card {
        padding: 1.8rem 1.2rem;
        min-height: 220px;
    }
    
    .tool-icon {
        font-size: 3rem;
    }
    
    .tool-card h2 {
        font-size: 1.25rem;
    }
    
    .tool-card p {
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .tool-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 2rem 3%;
    }
    
    .tool-card {
        padding: 1.5rem 1rem;
        min-height: auto;
        max-height: 200px;
    }
    
    .tool-icon {
        font-size: 2.5rem;
        margin-bottom: 0.8rem;
    }
    
    .tool-card h2 {
        font-size: 1.2rem;
        margin-bottom: 0.6rem;
    }
    
    .tool-card p {
        font-size: 0.85rem;
        line-height: 1.4;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
}

/* 卡片顶部装饰条 */
.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--secondary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

/* 卡片悬浮装饰效果 */
.tool-card::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.05);
    transform: translate(-50%, -50%);
    transition: width 0.5s ease, height 0.5s ease;
}

.tool-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.08);
}

.tool-card:hover::before {
    transform: scaleX(1);
}

.tool-card:hover::after {
    width: 300px;
    height: 300px;
}

.tool-icon {
    font-size: 3.8rem;
    margin-bottom: 1rem;
    color: var(--primary);
    transition: var(--transition);
    filter: drop-shadow(0 4px 6px rgba(59, 130, 246, 0.15));
    position: relative;
    z-index: 1;
}

.tool-icon img {
    max-width: 48px;
    max-height: 48px;
    object-fit: contain;
}

.tool-card:hover .tool-icon {
    transform: scale(1.15) rotate(5deg);
    color: var(--primary-dark);
}

.tool-card h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
    transition: var(--transition);
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.tool-card:hover h2 {
    color: var(--primary-dark);
}

.tool-card p {
    color: var(--text-light);
    font-size: 1rem;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.main-footer {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 2rem 1rem;
    text-align: center;
    margin-top: 4rem;
    position: relative;
    overflow: hidden;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.main-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

/* 页脚装饰元素 */
.main-footer::after {
    content: '';
    position: absolute;
    top: -10%;
    right: -10%;
    width: 40%;
    height: 60%;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 50%;
    filter: blur(50px);
    z-index: 0;
}

.main-footer .footer-content {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.main-footer p {
    margin: 0.5rem 0;
    font-size: 0.95rem;
    opacity: 0.9;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .main-header {
        padding: 2.5rem 1rem;
    }
    
    .main-header h1 {
        font-size: clamp(1.8rem, 8vw, 2.5rem);
    }
    
    .tool-grid {
        padding: 2.5rem 5%;
        gap: 1.8rem;
    }
    
    .tool-card {
        padding: 1.8rem 1.2rem;
    }
    
    .tool-icon {
        font-size: 3rem;
    }
}

/* 添加新工具提示 */
.add-tool-hint {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 1rem;
    border: 2px dashed #CBD5E1;
    color: var(--text-light);
    transition: var(--transition);
}

.add-tool-hint:hover {
    border-color: var(--primary-light);
    background: rgba(255, 255, 255, 0.8);
}

.add-tool-hint .tool-icon {
    color: #CBD5E1;
}

.add-tool-hint:hover .tool-icon {
    color: var(--primary-light);
    transform: scale(1.1);
}

/* 新增样式 */
.main-header.scrolled {
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding-top: 1rem;
    padding-bottom: 1rem;
    transition: all 0.3s ease;
}

/* 最近使用工具样式 */
.recent-tools {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 0.5rem;
    width: 100%;
    max-width: 800px;
}

.recent-tools h3 {
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
    color: var(--dark);
}

.recent-tools-list {
    display: flex;
    gap: 0.8rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.recent-tool-item {
    background-color: white;
    border-radius: 0.5rem;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.2s ease;
}

.recent-tool-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.no-recent {
    color: #888;
    font-size: 0.9rem;
    padding: 0.5rem 0;
}

/* 回到顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background-color: var(--primary);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    animation: pulse-light 2s infinite;
}

.back-to-top:hover {
    background-color: var(--primary-dark);
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
    border-color: rgba(255, 255, 255, 0.5);
}

.back-to-top:active {
    transform: translateY(-2px) scale(0.98);
}

/* 响应式调整 - 回到顶部按钮 */
@media (max-width: 768px) {
    .back-to-top {
        width: 2.5rem;
        height: 2.5rem;
        bottom: 1.5rem;
        right: 1.5rem;
    }
}