/* =========================================
   1. VARIABLES & RESET (配置与重置)
   ========================================= */
:root {
    /* --- Morandi Palette (莫兰迪色系) --- */
    --bg-color: #F2F0E9;
    /* 燕麦色背景 */
    --card-bg: #FFFFFF;
    /* 纯白卡片背景 */
    --text-primary: #3E4348;
    /* 深岩灰 */
    --text-secondary: #7A7F85;
    /* 暖灰 */
    --accent: #7895A2;
    /* 雾霾蓝 */
    --accent-hover: #5A7582;
    /* 深雾蓝 */
    --secondary: #BFA6A2;
    /* 陶土色 */
    --border: #E0DDD5;
    /* 边框色 */

    /* --- Effects --- */
    --shadow-sm: 0 4px 6px rgba(62, 67, 72, 0.05);
    --shadow-lg: 0 10px 30px rgba(120, 149, 162, 0.15);
    --radius: 16px;

    --font-stack: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* 全局重置：这一步最重要，防止布局挤压 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-stack);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
}

/* =========================================
   2. NAVIGATION (导航栏)
   ========================================= */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 5%;
    background: rgba(242, 240, 233, 0.95);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.brand {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.brand span {
    color: var(--accent);
}

/* 右侧按钮组 */
.nav-buttons {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.btn-sm {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.btn-sm:hover {
    color: var(--text-primary);
}

.primary-btn {
    background-color: var(--accent);
    color: white;
    padding: 0.7rem 1.5rem;
    border-radius: 99px;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    /* 防止按钮文字换行 */
}

.primary-btn:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(120, 149, 162, 0.3);
}

/* =========================================
   3. LAYOUT CONTAINER (通用容器)
   ========================================= */
.container {
    width: 100%;
    max-width: 1200px;
    /* 限制最大宽度，保证大屏美观 */
    margin: 0 auto;
    /* 居中 */
    padding: 0 1.5rem;
    /* 左右留白 */
}

/* =========================================
   4. HERO SECTION (首屏)
   ========================================= */
.hero {
    text-align: center;
    padding: 8rem 1rem 4rem;
    /* 顶部留足空间给导航栏 */
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    /* 响应式字体 */
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    line-height: 1.1;
    letter-spacing: -1px;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* =========================================
   5. TOOLS GRID (核心网格布局 - 修复版)
   ========================================= */
.tools-grid {
    display: grid;
    /* 核心魔法：列宽至少300px，能放几个放几个，自动换行 */
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    /* 卡片间距 */
    width: 100%;
    padding-bottom: 6rem;
}

.tool-card {
    background-color: var(--card-bg);
    /* 确保背景是白色的！ */
    border-radius: var(--radius);
    padding: 2.5rem;
    border: 1px solid transparent;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;

    /* 强制布局 */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    height: 100%;
    /* 让所有卡片等高 */
}

/* 悬停效果 */
.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.tool-icon {
    width: 50px;
    height: 50px;
    background: #F7F9FA;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    /* 这里的图标就是你的 emoji，不再会被遮挡 */
}

.tool-card h3 {
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 0.8rem;
    line-height: 1.3;
}

.tool-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.tool-card .arrow {
    margin-top: auto;
    /* 这一行把箭头推到最底部 */
    color: var(--accent);
    font-weight: bold;
    font-size: 1.2rem;
    transition: transform 0.3s;
}

.tool-card:hover .arrow {
    transform: translateX(5px);
}

/* =========================================
   6. TOOL PAGE UI (工具内页)
   ========================================= */
.input-card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 2rem;
}

textarea {
    width: 100%;
    background: #FAFAFA;
    border: 2px solid #EEE;
    border-radius: 12px;
    padding: 1.5rem;
    font-size: 1rem;
    font-family: inherit;
    min-height: 150px;
    margin-bottom: 1.5rem;
    transition: border-color 0.3s;
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: #FFF;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

/* AI 结果框 */
.result-box {
    background: #FFF;
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border-left: 5px solid var(--secondary);
    animation: fadeIn 0.5s ease;
    margin-top: 2rem;
}

.result-content h2 {
    color: var(--accent);
    font-size: 1.4rem;
    margin-top: 1.5rem;
}

.result-content p {
    margin-bottom: 1rem;
}

/* 懒加载类 */
.scroll-reveal {
    opacity: 1;
}

/* 暂时强制显示，防止JS没加载时看不见内容 */

/* =========================================
   7. MOBILE OPTIMIZATION (手机适配)
   ========================================= */
@media (max-width: 768px) {

    /* 导航栏修复 */
    nav {
        padding: 0.8rem 1rem;
    }

    .brand {
        font-size: 1.2rem;
    }

    /* 强制右侧按钮不换行 */
    nav>div:last-child {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .btn-sm {
        font-size: 0.75rem;
        margin-right: 0;
        padding: 0.4rem 0.6rem;
        background: rgba(0, 0, 0, 0.03);
        border-radius: 6px;
    }

    .primary-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    /* 首页卡片变单列 */
    .tools-grid {
        grid-template-columns: 1fr;
        /* 强制单列 */
        gap: 1.5rem;
    }

    .hero {
        padding-top: 4rem;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    /* 输入框防缩放 */
    textarea {
        font-size: 16px;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    #generateBtn {
        width: 100%;
    }

    .cf-turnstile {
        display: flex;
        justify-content: center;
    }
}

/* =========================================
   8. FOOTER (页脚)
   ========================================= */
footer {
    text-align: center;
    padding: 4rem 1.5rem;
    background: #EAE8E0;
    margin-top: 4rem;
}


.search-wrapper {
    position: relative;
    width: 100%;
    margin: 0 auto;
    transition: transform 0.3s ease;
}

.search-wrapper:focus-within {
    transform: translateY(-2px);
    /* 输入时轻微上浮 */
}

.search-wrapper input {
    width: 100%;
    padding: 1.2rem 1.2rem 1.2rem 3.5rem;
    /* 左边留出图标位置 */
    font-size: 1.1rem;
    border: 2px solid transparent;
    border-radius: 99px;
    /* 胶囊形状 */
    background: #FFFFFF;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    /* 柔和阴影 */
    outline: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
    font-family: inherit;
}

.search-wrapper input:focus {
    box-shadow: 0 8px 25px rgba(120, 149, 162, 0.2);
    border-color: var(--accent);
}

.search-wrapper input::placeholder {
    color: #CCC;
}

.search-icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    opacity: 0.5;
    pointer-events: none;
    /* 防止遮挡点击 */
}

/* 手机适配 */
@media (max-width: 768px) {
    .search-wrapper input {
        padding: 1rem 1rem 1rem 3rem;
        font-size: 1rem;
    }
}