/* 自定义样式 - 与UI风格保持一致 */
body::before {
    background: #f0f0f0;
    background-position: center 0;
    background-repeat: no-repeat;
    background-size: cover;
    background-image: linear-gradient(-225deg, #E3FDF5, #FFE6FA 100%);
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.tool-card {
    background: var(--background);
    border-radius: var(--radius-inner);
    box-shadow: var(--box-shadow);
    padding: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--classC);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 140px;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
    border-color: var(--theme);
}

.tool-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--main);
    margin-bottom: 8px;
    text-shadow: var(--text-bt);
}

.tool-desc {
    font-size: 13px;
    color: var(--minor);
    line-height: 1.4;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 2.8em; /* 确保两行高度 */
    flex: 1;
}

.tool-link {
    display: inline-block;
    background: var(--theme);
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius-inner-s);
    text-decoration: none;
    font-size: 13px;
    transition: background 0.3s ease;
    align-self: flex-end;
    margin-top: auto;
}

.tool-link:hover {
    background: var(--theme);
    opacity: 0.9;
}

.category-tabs {
    display: flex;
    gap: 15px;
    margin: 30px 0 20px 0;
    flex-wrap: wrap;
}

.category-tab {
    padding: 10px 20px;
    background: var(--background);
    border: 1px solid var(--classC);
    border-radius: var(--radius-inner);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.category-tab.active {
    background: var(--theme);
    color: white;
    border-color: var(--theme);
}

.category-tab:hover {
    border-color: var(--theme);
}

/* 分类标签样式优化 */
.category-tabs-container {
    display: flex;
    justify-content: center;
    padding: 20px 0;
    background: var(--background);
}

.category-tabs {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 0;
}

.category-tab {
    padding: 10px 20px;
    background: var(--background);
    border: 1px solid var(--classC);
    border-radius: var(--radius-inner);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.category-tab.active {
    background: var(--theme);
    color: white;
    border-color: var(--theme);
}

.category-tab:hover {
    border-color: var(--theme);
}

/* 工具卡片样式 */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.tool-card {
    background: var(--background);
    border-radius: var(--radius-inner);
    box-shadow: var(--box-shadow);
    padding: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--classC);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 140px;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
    border-color: var(--theme);
}

.tool-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--main);
    margin-bottom: 8px;
    text-shadow: var(--text-bt);
}

.tool-desc {
    font-size: 13px;
    color: var(--minor);
    line-height: 1.4;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 2.8em; /* 确保两行高度 */
    flex: 1;
}

.tool-link {
    display: inline-block;
    background: var(--theme);
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius-inner-s);
    text-decoration: none;
    font-size: 13px;
    transition: background 0.3s ease;
    align-self: flex-end;
    margin-top: auto;
}

.tool-link:hover {
    background: var(--theme);
    opacity: 0.9;
}

.no-results {
    text-align: center;
    padding: 40px 20px;
    color: var(--minor);
    font-size: 14px;
}

@media (max-width: 768px) {
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    .category-tabs {
        justify-content: center;
    }
}

.no-results {
    text-align: center;
    padding: 40px 20px;
    color: var(--minor);
    font-size: 14px;
}

@media (max-width: 768px) {
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    .category-tabs {
        justify-content: center;
    }
}

/* 星空背景样式 */
#universe {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

[data-night="night"] #universe {
    opacity: 1;
}

/* 动态背景：多重径向渐变缓慢漂浮 */
.animated-bg {
    position: fixed;
    inset: -20%;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(600px 300px at 20% 20%, rgba(59,130,246,.10), transparent 60%),
        radial-gradient(600px 300px at 80% 30%, rgba(14,165,233,.10), transparent 60%),
        radial-gradient(700px 400px at 50% 80%, rgba(99,102,241,.10), transparent 60%);
    filter: blur(20px);
    animation: floatBg 18s ease-in-out infinite alternate;
    opacity: .8;
}

[data-night="night"] .animated-bg {
    opacity: .6;
    background:
        radial-gradient(600px 300px at 20% 20%, rgba(59,130,246,.12), transparent 60%),
        radial-gradient(600px 300px at 80% 30%, rgba(14,165,233,.12), transparent 60%),
        radial-gradient(700px 400px at 50% 80%, rgba(99,102,241,.14), transparent 60%);
}

@keyframes floatBg {
    0% { transform: translate3d(0,0,0) scale(1); }
    100% { transform: translate3d(2%, -3%, 0) scale(1.03); }
}

@media (prefers-reduced-motion: reduce) {
    .animated-bg { animation: none; }
}

/* 分类间距优化 */
.category-section {
    margin-bottom: 25px;
}

.category-section:last-child {
    margin-bottom: 0;
}

.category-section .title_bj {
    margin-bottom: 15px;
}

.category-section .tools-grid {
    margin-top: 10px;
}

/* 返回顶部按钮样式 */
.back-to-top {
    position: fixed;
    right: 40px;
    bottom: 80px;
    z-index: 500;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--background);
    box-shadow: 0 0 10px rgb(0 0 0 / 10%), 0 5px 20px rgb(0 0 0 / 20%);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    border: 1px solid var(--classC);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--theme);
    border-color: var(--theme);
}

.back-to-top:hover svg {
    color: white;
}

.back-to-top svg {
    width: 18px;
    height: 18px;
    color: var(--main);
    transition: color 0.3s ease;
}

/* 分类间距优化 */
.category-section {
    margin-bottom: 25px;
}

.category-section:last-child {
    margin-bottom: 0;
}

.category-section .title_bj {
    margin-bottom: 15px;
}

.category-section .tools-grid {
    margin-top: 10px;
}

/* 返回顶部按钮样式 */
.back-to-top {
    position: fixed;
    right: 40px;
    bottom: 80px;
    z-index: 500;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--background);
    box-shadow: 0 0 10px rgb(0 0 0 / 10%), 0 5px 20px rgb(0 0 0 / 20%);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    border: 1px solid var(--classC);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--theme);
    border-color: var(--theme);
}

.back-to-top:hover svg {
    color: white;
}

.back-to-top svg {
    width: 18px;
    height: 18px;
    color: var(--main);
    transition: color 0.3s ease;
}