/* =========================================
   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, sans-serif;
}

* {
    box-sizing: border-box;
    /* 关键：防止 padding 撑破布局 */
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-stack);
    margin: 0;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    /* 让字体在 Mac/iOS 上更清晰 */
}

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.9);
    /* 毛玻璃背景 */
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

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

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

/* 次要按钮 (Agency Link) */
.btn-sm {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s;
    margin-right: 1.5rem;
}

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

/* 主要按钮 (CTA) */
.primary-btn {
    background-color: var(--accent);
    color: white;
    padding: 0.8rem 1.8rem;
    border-radius: 99px;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    display: inline-block;
    text-align: center;
}

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

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* =========================================
   3. HERO SECTION (首页首屏)
   ========================================= */
.hero {
    text-align: center;
    padding: 6rem 1rem 4rem;
    animation: fadeInDown 1s ease-out;
}

.hero h1 {
    font-size: 3.5rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    letter-spacing: -1.5px;
    line-height: 1.1;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 3rem;
}

/* =========================================
   4. CARD GRID (Bento Grid 布局)
   ========================================= */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    padding-bottom: 6rem;
}

.tool-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2.5rem;
    border: 1px solid transparent;
    box-shadow: var(--shadow-sm);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    overflow: hidden;
    display: block;
    /* Ensure full area is clickable */

    /* 懒加载初始状态 */
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out, box-shadow 0.3s ease, transform 0.3s ease;
}

.tool-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.tool-icon {
    width: 60px;
    height: 60px;
    background: #F7F9FA;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--accent);
}

.tool-card h3 {
    margin: 0 0 0.8rem 0;
    color: var(--text-primary);
    font-size: 1.35rem;
}

.tool-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0;
}

.tool-card .arrow {
    position: absolute;
    bottom: 2.5rem;
    right: 2.5rem;
    opacity: 0;
    color: var(--accent);
    transition: all 0.3s;
    font-size: 1.2rem;
}

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

/* =========================================
   5. TOOL PAGE UI (工具页样式)
   ========================================= */
.input-card {
    background: var(--card-bg);
    padding: 3rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

textarea {
    width: 100%;
    background: #FAFAFA;
    border: 2px solid #EEE;
    border-radius: 12px;
    padding: 1.5rem;
    font-size: 1.1rem;
    color: var(--text-primary);
    min-height: 180px;
    transition: all 0.3s;
    font-family: inherit;
    margin-bottom: 1.5rem;
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: white;
    box-shadow: 0 0 0 4px rgba(120, 149, 162, 0.1);
}

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

/* Result Box */
.result-box {
    margin-top: 3rem;
    background: #FFF;
    padding: 3rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border-left: 5px solid var(--secondary);
    animation: fadeIn 0.5s ease;
}

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

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

.result-content ul {
    padding-left: 1.2rem;
    color: #555;
}

/* =========================================
   6. ANIMATIONS (动画)
   ========================================= */
.reveal {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* =========================================
   7. MOBILE OPTIMIZATION (修复版 - 解决按钮重叠)
   ========================================= */
@media (max-width: 768px) {

    /* 1. 导航栏布局修复 */
    nav {
        padding: 0.8rem 1rem;
        /* 减小两侧留白，给按钮腾地儿 */
    }

    .brand {
        font-size: 1.1rem;
        /* Logo稍微变小 */
    }

    /* 【核心修复】强制右侧两个按钮横向排列，不换行 */
    nav>div:last-child {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        /* 按钮之间的间距 */
    }

    /* Agency Services 按钮 */
    .btn-sm {
        display: inline-block;
        font-size: 0.7rem;
        /* 字体调小 */
        margin-right: 0;
        /* 去除原来的右边距，改用 gap 控制 */
        padding: 0.4rem 0.6rem;
        background: rgba(0, 0, 0, 0.05);
        border-radius: 6px;
        white-space: nowrap;
        /* 禁止文字换行 */
        line-height: 1;
        /* 修正垂直对齐 */
    }

    /* Start Writing 按钮 */
    .primary-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.75rem;
        /* 字体调小 */
        white-space: nowrap;
        /* 禁止文字换行 */
        line-height: 1;
    }

    /* 2. Hero 区域优化 */
    .hero {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }

    .hero h1 {
        font-size: 2rem;
        /* 防止标题太大撑开页面 */
        margin-bottom: 1rem;
    }

    .hero p {
        font-size: 0.95rem;
        padding: 0 0.5rem;
        line-height: 1.5;
    }

    /* 3. 网格改为单列 */
    .tools-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding-bottom: 3rem;
    }

    .tool-card {
        padding: 1.5rem;
    }

    /* 4. 工具页输入框优化 */
    .input-card {
        padding: 1.2rem;
    }

    textarea {
        font-size: 16px;
        /* 防止 iOS 缩放 */
        min-height: 150px;
        padding: 1rem;
    }

    /* 5. 底部按钮控制区 */
    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.8rem;
    }

    #generateBtn {
        width: 100%;
        padding: 0.9rem;
    }

    .cf-turnstile {
        display: flex;
        justify-content: center;
        margin-bottom: 0.2rem;
        transform: scale(0.9);
        /* 稍微缩小验证码，防止撑破小屏手机 */
        transform-origin: center;
    }

    .result-box {
        padding: 1.5rem;
        margin-top: 2rem;
    }
}