:root {
    --primary: #2563eb;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    font-size: 15px;
}

a { text-decoration: none; color: inherit; }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px); /* 增加磨砂玻璃效果 */
    background: rgba(255, 255, 255, 0.9);
}
.site-header .container { display: flex; justify-content: space-between; align-items: center; }
.logo { font-weight: 700; font-size: 1.25rem; color: var(--primary); letter-spacing: -0.5px; }

/* Main Content */
.main-content { padding: 3rem 0; min-height: 80vh; }

/* Hero Section */
.hero-section { text-align: center; margin-bottom: 3rem; }
.hero-section h2 { font-size: 2rem; margin-bottom: 0.5rem; color: var(--text-main); letter-spacing: -0.5px; }
.hero-section p { color: var(--text-muted); font-size: 1.05rem; }

/* Category Title */
.category-title {
    margin: 2.5rem 0 1.2rem;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-main);
    padding-left: 12px;
    border-left: 4px solid var(--primary);
    line-height: 1.2;
}
.hero-section + .category-title { margin-top: 1rem; }

/* Grid System */
.tools-grid {
    display: grid;
    /* 恢复舒适的卡片宽度，手机端自动单列，电脑端多列 */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Tool Cards */
.tool-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgb(0 0 0 / 0.05);
    border: 1px solid var(--border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column; /* 上下结构更稳重 */
    align-items: flex-start;
    gap: 0.8rem;
    height: 100%;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    border-color: var(--primary);
}

.card-icon {
    width: 44px;
    height: 44px;
    background: #eff6ff;
    color: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
}

.card-info h3 { 
    font-size: 1.1rem; 
    margin-bottom: 0.4rem; 
    font-weight: 600;
    color: var(--text-main);
}

.card-info p { 
    font-size: 0.9rem; 
    color: var(--text-muted); 
    line-height: 1.5;
    /* 限制显示3行，保持整洁 */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Tool Detail Page */
.tool-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}
.tool-header {
    padding: 2.5rem;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}
.tool-header h1 { font-size: 1.8rem; margin: 0.8rem 0 0.5rem; letter-spacing: -0.5px; }
.tool-desc { color: var(--text-muted); font-size: 1rem; }
.tool-body { padding: 2.5rem; }

/* Badge */
.badge {
    background: #eff6ff;
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

/* Form Elements */
.form-group { margin-bottom: 1.5rem; }
.form-label { display: block; margin-bottom: 0.5rem; font-weight: 500; font-size: 0.95rem; }
.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem; /* 16px 标准字体 */
    font-family: monospace;
    transition: border-color 0.2s;
    background: #fff;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }

.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 1rem;
    transition: opacity 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn:hover { opacity: 0.9; }

.result-box {
    background: #f1f5f9;
    padding: 1.2rem;
    border-radius: 8px;
    margin-top: 1.5rem;
    font-family: monospace;
    font-size: 0.9rem;
    word-break: break-all;
    border: 1px solid #e2e8f0;
    line-height: 1.6;
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 3rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* === Mobile Optimization (仅做必要调整，不破坏结构) === */
@media (max-width: 768px) {
    .container { padding: 0 16px; }
    .main-content { padding: 2rem 0; }
    
    .hero-section h2 { font-size: 1.6rem; }
    
    /* 手机端保持单列，但稍微紧凑一点点 */
    .tools-grid { 
        gap: 1rem; 
        grid-template-columns: 1fr; /* 手机端单列更美观 */
    }
    
    .tool-card { 
        padding: 1.2rem; 
        flex-direction: row; /* 手机端改为【左图标-右文字】布局，更符合阅读习惯 */
        align-items: flex-start;
    }
    
    .card-icon { width: 40px; height: 40px; margin-bottom: 0; margin-right: 0.5rem; }
    .card-info h3 { margin-top: 0; font-size: 1.05rem; }
    .card-info p { -webkit-line-clamp: 2; font-size: 0.85rem; }

    .tool-header, .tool-body { padding: 1.5rem; }
    .tool-header h1 { font-size: 1.4rem; }
    
    .btn { width: 100%; } /* 手机端按钮全宽方便点击 */
}