/* ========== 全局变量与重置 ========== */
:root {
    /* 主色调 */
    --primary: #ff6b00;
    --primary-dark: #e65c00;
    --primary-light: #ff8a33;
    
    /* 浅色模式 */
    --bg-body: #f5f7fa;
    --bg-card: #ffffff;
    --bg-header: #ffffff;
    --bg-sidebar: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #e5e7eb;
    --border-hover: #ff6b00;
    --grid-color: rgba(0, 0, 0, 0.03);
    /* 全站橙色氛围光（固定视口角渐变，低透明度不干扰阅读） */
    --glow-1: rgba(255, 107, 0, 0.08);
    --glow-2: rgba(255, 107, 0, 0.05);
    
    /* 状态色 */
    --tag-new: #10b981;
    --tag-hot: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    
    /* 圆角与阴影 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    
    /* 布局 */
    --header-height: 60px;
    --container-width: 1200px;
}

/* 深色模式 */
[data-theme="dark"] {
    --bg-body: #0f1115;
    --bg-card: #1a1d23;
    --bg-header: #1a1d23;
    --bg-sidebar: #1a1d23;
    --text-primary: #f0f0f0;
    --text-secondary: #a0a6b1;
    --text-muted: #6b7280;
    --border-color: #2a2f38;
    --grid-color: rgba(255, 255, 255, 0.02);
    --glow-1: rgba(255, 107, 0, 0.12);
    --glow-2: rgba(255, 107, 0, 0.08);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
    /* 背景：固定橙色角光晕（氛围光）；科技网格改由 common.js 粒子层以动态点阵呈现 */
    background-image:
        radial-gradient(70vmax 70vmax at 100% 0%, var(--glow-1), transparent 60%),
        radial-gradient(60vmax 60vmax at 0% 100%, var(--glow-2), transparent 55%);
    background-size: auto, auto;
    background-attachment: fixed, fixed;
    background-repeat: no-repeat, no-repeat;
    transition: background-color 0.3s, color 0.3s;
}

/* 全站动态粒子背景（canvas 由 common.js 注入，固定视口、不挡交互） */
#bg-particles {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary);
}

/* ========== 顶部导航栏 ========== */
.site-header {
    height: var(--header-height);
    background: var(--bg-header);
    background: color-mix(in srgb, var(--bg-header) 80%, transparent);
    border-bottom: 1px solid var(--border-color);
    border-bottom-color: color-mix(in srgb, var(--primary) 28%, var(--border-color));
    position: sticky;
    top: 0;
    z-index: 100;
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    backdrop-filter: blur(12px) saturate(160%);
    box-shadow: 0 2px 18px rgba(255, 107, 0, 0.08);
}

.header-container {
    max-width: var(--container-width);
    height: 100%;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 18px;
    color: var(--text-primary);
}

.logo-icon {
    width: 28px;
    height: 28px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 900;
}

.nav-menu {
    display: flex;
    gap: 24px;
    list-style: none;
}

.nav-menu a {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--primary);
}

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

.theme-toggle {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ========== 主容器 ========== */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 30px 20px;
}

/* ========== 英雄区（首页） ========== */
.hero-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.hero-title {
    font-size: 42px;
    font-weight: 900;
    line-height: 1.2;
    margin-bottom: 12px;
    letter-spacing: -1px;
}

.hero-title span {
    color: var(--primary);
}

.hero-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
    max-width: 500px;
}

.search-box {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    max-width: 500px;
}

.search-box input {
    flex: 1;
    height: 44px;
    padding: 0 16px;
    border: 2px solid var(--border-color);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: var(--primary);
}

.search-box button {
    height: 44px;
    padding: 0 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.search-box button:hover {
    background: var(--primary-dark);
}

.hot-tags {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-muted);
}

.hot-tags span {
    padding: 4px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.hot-tags span:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* 统计卡片 */
.stats-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.stats-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
    font-size: 12px;
    color: var(--text-muted);
    font-family: monospace;
}

.stats-card-header .online {
    color: var(--success);
}

.stats-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.stats-item .label {
    color: var(--text-secondary);
    font-size: 13px;
}

.stats-item .value {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
}

.stats-progress {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.stats-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    width: 100%;
}

/* ========== 分类筛选栏 ========== */
.category-filter {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 30px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow-x: auto;
}

.category-filter-item {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.category-filter-item:hover {
    color: var(--primary);
}

.category-filter-item.active {
    background: var(--primary);
    color: white;
    font-weight: 500;
}

/* ========== 工具分类区块 ========== */
.category-section {
    margin-bottom: 40px;
    scroll-margin-top: 80px;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.category-number {
    width: 28px;
    height: 28px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
}

.category-title {
    font-size: 18px;
    font-weight: 700;
}

.category-count {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

/* 工具卡片网格 */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.tool-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.tool-card-number {
    font-size: 11px;
    color: var(--text-muted);
    font-family: monospace;
    margin-bottom: 8px;
}

.tool-card-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tool-card-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 标签 */
.tag {
    display: inline-block;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 3px;
    color: white;
}

.tag-new {
    background: var(--tag-new);
}

.tag-hot {
    background: var(--tag-hot);
}

/* ========== 工具详情页布局 ========== */
.tool-page-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 30px;
}

/* 侧边栏 */
.sidebar {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    position: sticky;
    top: 80px;
    height: fit-content;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.sidebar-category {
    margin-bottom: 16px;
}

.sidebar-category-title {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
    padding-left: 8px;
    border-left: 3px solid var(--primary);
}

.sidebar-tool-list {
    list-style: none;
}

.sidebar-tool-list li a {
    display: block;
    padding: 6px 10px;
    font-size: 13px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.sidebar-tool-list li a:hover,
.sidebar-tool-list li a.active {
    background: rgba(255, 107, 0, 0.1);
    color: var(--primary);
}

/* 工具主内容区 */
.tool-main {
    min-width: 0;
}

.tool-breadcrumb {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.tool-breadcrumb a:hover {
    color: var(--primary);
}

.tool-content-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.tool-content-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.tool-content-desc {
    color: var(--text-secondary);
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

/* ========== 底部 ========== */
.site-footer {
    margin-top: 60px;
    padding: 24px 20px;
    border-top: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border-color));
    background: color-mix(in srgb, var(--bg-header) 82%, transparent);
    -webkit-backdrop-filter: blur(10px) saturate(160%);
    backdrop-filter: blur(10px) saturate(160%);
    color: var(--text-muted);
    font-size: 12px;
}

.footer-container {
    max-width: var(--container-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.footer-links {
    display: flex;
    gap: 16px;
}

/* ========== 通用组件 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    background: var(--text-primary);
    color: var(--bg-body);
    border-radius: var(--radius-sm);
    font-size: 13px;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.toast.show {
    opacity: 1;
}

/* ========== 响应式适配 ========== */
@media (max-width: 1024px) {
    .tools-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .hero-section {
        grid-template-columns: 1fr;
    }
    
    .stats-card {
        order: -1;
    }
}

@media (max-width: 768px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tool-page-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
        max-height: none;
    }
    
    .hero-title {
        font-size: 32px;
    }
    
    .nav-menu {
        display: none;
    }
    
    .footer-container {
        flex-direction: column;
        text-align: center;
    }
}
/* 移动端侧边栏适配 */
.sidebar-toggle {
    display: none;
    width: 100%;
    margin-bottom: 16px;
    padding: 10px 12px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    text-align: left;
    box-sizing: border-box;
}
.sidebar-toggle:focus {
    outline: none;
    border-color: var(--primary);
}

@media (max-width: 768px) {
    .sidebar-toggle {
        display: block;
    }
    .sidebar {
        display: none;
    }
    .sidebar.mobile-show {
        display: block;
    }
}
/* 移动端：工具内容置顶，侧边栏置底 */
@media (max-width: 768px) {
    .tool-page-layout {
        flex-direction: column;
    }
    .tool-main {
        order: 1;
    }
    .sidebar {
        order: 2;
        margin-top: 20px;
    }
}
@media (max-width: 768px) {
    .sidebar-toggle {
        margin-top: 16px;
        text-align: center;
    }
    /* 侧边栏展开后在按钮下方，和页面底部保持间距 */
    .sidebar.mobile-show {
        margin-top: 16px;
    }
}