:root {
    --primary-color: #4361ee;
    --primary-light: #4895ef;
    --primary-dark: #3a0ca3;
    --secondary-color: #7209b7;
    --accent-color: #f72585;
    --success-color: #4cc9f0;
    --light-bg: #f8f9fa;
    --dark-bg: #121826;
    --card-bg-light: #ffffff;
    --card-bg-dark: #1e293b;
    --text-color-light: #2d3748;
    --text-color-dark: #e2e8f0;
    --text-muted-light: #718096;
    --text-muted-dark: #94a3b8;
    --border-color-light: #e2e8f0;
    --border-color-dark: #334155;
    --shadow-light: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-dark: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --light-bg: var(--dark-bg);
    --card-bg: var(--card-bg-dark);
    --text-color: var(--text-color-dark);
    --text-muted: var(--text-muted-dark);
    --border-color: var(--border-color-dark);
    --shadow: var(--shadow-dark);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-color);
    line-height: 1.6;
    transition: var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== 头部样式 ===== */
.header {
    background-color: var(--card-bg-light);
    box-shadow: var(--shadow-light);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
}
[data-theme="dark"] .header {
    background-color: var(--card-bg-dark);
    box-shadow: var(--shadow-dark);
}
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
}
.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin: 0;
}
.main-nav .controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.search-form {
    display: flex;
    align-items: center;
    background: var(--light-bg);
    border-radius: 50px;
    padding: 8px 20px;
    border: 1px solid var(--border-color-light);
    transition: var(--transition);
}
[data-theme="dark"] .search-form {
    background: #2d3748;
    border-color: var(--border-color-dark);
}
.search-form i {
    color: var(--text-muted-light);
    margin-right: 10px;
}
.search-form input {
    border: none;
    background: transparent;
    color: var(--text-color);
    font-size: 0.95rem;
    width: 220px;
    outline: none;
}
.category-filter, .lang-switcher, .theme-toggle, .admin-link {
    padding: 10px 18px;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}
.category-filter {
    background: var(--light-bg);
    border-color: var(--border-color-light);
    color: var(--text-color);
}
[data-theme="dark"] .category-filter {
    background: #2d3748;
    border-color: var(--border-color-dark);
}
.lang-switcher {
    display: flex;
    background: var(--light-bg);
    border-color: var(--border-color-light);
}
[data-theme="dark"] .lang-switcher {
    background: #2d3748;
    border-color: var(--border-color-dark);
}
.lang-switcher a {
    padding: 0 8px;
    text-decoration: none;
    color: var(--text-muted-light);
}
.lang-switcher a.active {
    color: var(--primary-color);
    font-weight: 600;
}
.theme-toggle {
    background: var(--light-bg);
    border-color: var(--border-color-light);
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
}
.theme-toggle:hover {
    background: var(--primary-color);
    color: white;
    transform: rotate(15deg);
}
.admin-link {
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
}
.admin-link:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* ===== 英雄区域 [citation:2][citation:10] ===== */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 80px 0;
    text-align: center;
    margin-bottom: 60px;
}
.hero-content h2 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 20px;
    line-height: 1.2;
}
.hero-content p {
    font-size: 1.2rem;
    max-width: 700px;
    margin: 0 auto;
    opacity: 0.9;
}

/* ===== 主内容区 ===== */
.main-content {
    flex: 1;
    padding: 20px 0 60px;
}
.category-section {
    margin-bottom: 60px;
}
.category-section h2 {
    font-size: 1.8rem;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color-light);
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
}
[data-theme="dark"] .category-section h2 {
    border-bottom-color: var(--border-color-dark);
}
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 28px;
}
.tool-card {
    background: var(--card-bg-light);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-light);
    transition: var(--transition);
    border: 1px solid var(--border-color-light);
    height: 100%;
}
[data-theme="dark"] .tool-card {
    background: var(--card-bg-dark);
    box-shadow: var(--shadow-dark);
    border-color: var(--border-color-dark);
}
.tool-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
}
.tool-card-inner {
    padding: 28px;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.tool-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 22px;
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
[data-theme="dark"] .tool-icon {
    background: linear-gradient(135deg, #1e3a8a, #1e40af);
}
.tool-icon img {
    width: 70%;
    height: 70%;
    object-fit: contain;
}
.tool-info {
    flex: 1;
}
.tool-info h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-color);
}
.tool-info p {
    color: var(--text-muted-light);
    margin-bottom: 24px;
    font-size: 0.95rem;
    line-height: 1.6;
    flex: 1;
}
[data-theme="dark"] .tool-info p {
    color: var(--text-muted-dark);
}
.tool-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    align-self: flex-start;
}
.tool-link:hover {
    background: var(--primary-dark);
    gap: 12px;
}
.no-results {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted-light);
}
.no-results p {
    font-size: 1.2rem;
    margin-bottom: 25px;
}
.btn {
    display: inline-block;
    padding: 14px 32px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    font-size: 1rem;
}
.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
}

/* ===== 页脚 ===== */
.footer {
    background: var(--card-bg-light);
    color: var(--text-muted-light);
    padding: 50px 0 30px;
    margin-top: auto;
    border-top: 1px solid var(--border-color-light);
}
[data-theme="dark"] .footer {
    background: var(--card-bg-dark);
    border-top-color: var(--border-color-dark);
    color: var(--text-muted-dark);
}
.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 40px;
}
.footer-info p {
    margin-bottom: 12px;
    font-size: 0.9rem;
    line-height: 1.7;
}
.footer-info a {
    color: var(--primary-color);
    text-decoration: none;
}
.badges {
    display: flex;
    gap: 25px;
    align-items: center;
    flex-wrap: wrap;
}
.badge-img {
    height: 32px !important; /* 控制徽章大小 [citation:3] */
    width: auto;
    opacity: 0.9;
    transition: opacity 0.3s;
}
.badge-img:hover {
    opacity: 1;
}
.cloudflare-info {
    max-width: 220px;
}
.cloudflare-info p {
    font-size: 0.85rem;
    margin-bottom: 8px;
    line-height: 1.5;
}
.cf-logo {
    width: 150px;
    height: auto;
    margin: 10px 0;
}
.trademark {
    font-size: 0.7rem !important;
    color: #999 !important;
    margin-top: 12px;
    line-height: 1.4;
}

/* ===== 后台样式 (基本保持原样，略作美化) ===== */
.admin-header {
    background: linear-gradient(90deg, var(--secondary-color), var(--primary-dark));
    color: white;
    padding: 20px 0;
    box-shadow: var(--shadow);
}
.admin-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}
.admin-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.btn-logout {
    background: #ef4444;
}
.btn-logout:hover {
    background: #dc2626;
}
.admin-section {
    background: var(--card-bg-light);
    border-radius: var(--radius);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color-light);
}
[data-theme="dark"] .admin-section {
    background: var(--card-bg-dark);
    box-shadow: var(--shadow-dark);
    border-color: var(--border-color-dark);
}
/* ... (后台其他样式如 .tool-item, .form-grid 等与之前类似，确保适配新主题变量即可) ... */

/* ===== 响应式设计 ===== */
@media (max-width: 1024px) {
    .tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    .hero-content h2 {
        font-size: 2.5rem;
    }
}
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 20px;
        padding: 20px;
    }
    .main-nav .controls {
        justify-content: center;
        width: 100%;
    }
    .search-form input {
        width: 180px;
    }
    .hero {
        padding: 60px 0;
    }
    .hero-content h2 {
        font-size: 2rem;
    }
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 30px;
    }
    .badges {
        justify-content: center;
    }
    .admin-nav {
        flex-direction: column;
        text-align: center;
    }
}
@media (max-width: 480px) {
    .tools-grid {
        grid-template-columns: 1fr;
    }
    .container {
        padding: 0 16px;
    }
}