/* ===== 全局重置与基础 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 100%);
    color: #1e293b;
    line-height: 1.6;
    scroll-behavior: smooth;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ===== 导航 ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
    transition: all 0.3s ease;
}

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #6366f1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo i {
    font-size: 1.8rem;
}

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

.nav-link {
    font-weight: 500;
    color: #475569;
    padding: 6px 0;
    position: relative;
    transition: color 0.3s;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: #6366f1;
    transition: width 0.3s;
}

.nav-link:hover {
    color: #6366f1;
}

.nav-link:hover::after {
    width: 100%;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 5px;
    padding: 5px;
}

.bar {
    width: 26px;
    height: 3px;
    background: #1e293b;
    border-radius: 2px;
    transition: all 0.3s;
}

/* ===== Hero 区 ===== */
.hero {
    padding: 140px 0 80px;
    min-height: 80vh;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 50%, #dbeafe 100%);
}

.hero-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    flex-wrap: wrap;
}

.hero-text {
    flex: 1;
    min-width: 300px;
}

.hero-text h1 {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 20px;
    color: #1e293b;
}

.hero-text .highlight {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-text p {
    font-size: 1.1rem;
    color: #64748b;
    max-width: 500px;
    margin-bottom: 30px;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    padding: 14px 32px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
}

.hero-visual {
    flex: 1;
    min-width: 280px;
    display: flex;
    justify-content: center;
}

.keyword-cloud {
    position: relative;
    width: 300px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

.kw-item {
    background: white;
    padding: 8px 18px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #6366f1;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
    animation: float 3s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.2s);
    cursor: default;
    transition: all 0.3s;
}

.kw-item:hover {
    transform: scale(1.1);
    background: #6366f1;
    color: white;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

/* ===== 通用 section ===== */
.section-header {
    text-align: center;
    margin-bottom: 48px;
}

.section-header h2 {
    font-size: 2.2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 10px;
}

.section-header p {
    color: #64748b;
    font-size: 1.05rem;
}

/* ===== 功能特点 ===== */
.features {
    padding: 80px 0;
    background: white;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 30px;
}

.feature-card {
    background: #f8faff;
    border-radius: 20px;
    padding: 36px 28px;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid rgba(99, 102, 241, 0.06);
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.feature-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.2);
}

.feature-icon {
    font-size: 2.4rem;
    color: #6366f1;
    margin-bottom: 16px;
    background: rgba(99, 102, 241, 0.1);
    width: 72px;
    height: 72px;
    line-height: 72px;
    border-radius: 50%;
    margin: 0 auto 20px;
}

.feature-card h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: #1e293b;
}

.feature-card p {
    color: #64748b;
    font-size: 0.95rem;
}

/* ===== 生成器 ===== */
.generator {
    padding: 80px 0;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 100%);
}

.generator-card {
    background: white;
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.08);
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 30px;
}

.input-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.input-group input[type="text"],
.input-group select {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    background: #f8faff;
    transition: border 0.3s, box-shadow 0.3s;
    outline: none;
}

.input-group input[type="text"]:focus,
.input-group select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.input-group input[type="range"] {
    width: 100%;
    accent-color: #6366f1;
    height: 6px;
    border-radius: 4px;
}

#countDisplay {
    font-weight: 700;
    color: #6366f1;
}

.btn-generate {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    padding: 14px;
    border: none;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    margin-top: 8px;
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn-generate:active {
    transform: scale(0.97);
}

.result-area {
    display: flex;
    flex-direction: column;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.result-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-sm {
    padding: 8px 14px;
    border: none;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
    background: #f1f5f9;
    color: #1e293b;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-sm:hover {
    background: #e2e8f0;
}

.btn-sm.btn-danger {
    background: #fee2e2;
    color: #dc2626;
}

.btn-sm.btn-danger:hover {
    background: #fecaca;
}

.keyword-list {
    background: #f8faff;
    border-radius: 16px;
    padding: 16px;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-content: flex-start;
    border: 2px dashed #e2e8f0;
    transition: border-color 0.3s;
}

.keyword-list:not(:has(.empty-state)) {
    border-color: #c7d2fe;
}

.empty-state {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    padding: 40px 20px;
    text-align: center;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.kw-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: white;
    border: 1px solid #e2e8f0;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.85rem;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.kw-chip:hover {
    border-color: #6366f1;
    background: #eef2ff;
}

.kw-chip.selected {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
}

.kw-chip.selected i {
    color: white;
}

.kw-chip i {
    font-size: 0.75rem;
    color: #94a3b8;
}

/* ===== 历史记录 ===== */
.history {
    padding: 80px 0;
    background: white;
}

.history-card {
    background: #f8faff;
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.02);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 100px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 14px 20px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s;
}

.history-item:hover {
    border-color: #c7d2fe;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.06);
}

.history-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-keyword {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.95rem;
}

.history-meta {
    font-size: 0.8rem;
    color: #94a3b8;
}

.history-actions {
    display: flex;
    gap: 8px;
}

.history-actions .btn-sm {
    font-size: 0.8rem;
    padding: 6px 12px;
}

/* ===== 页脚 ===== */
.footer {
    background: #1e293b;
    color: #94a3b8;
    text-align: center;
    padding: 24px 0;
    font-size: 0.9rem;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #1e293b;
    color: white;
    padding: 14px 24px;
    border-radius: 14px;
    font-weight: 500;
    font-size: 0.95rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    transform: translateY(80px);
    opacity: 0;
    transition: all 0.4s ease;
    z-index: 9999;
    max-width: 350px;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .hero-text h1 {
        font-size: 2.2rem;
    }
    .hero-content {
        flex-direction: column;
        text-align: center;
    }
    .hero-text p {
        margin-left: auto;
        margin-right: auto;
    }
    .generator-card {
        grid-template-columns: 1fr;
    }
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 68px;
        flex-direction: column;
        background: white;
        width: 100%;
        text-align: center;
        transition: left 0.3s;
        padding: 20px 0;
        box-shadow: 0 10px 30px rgba(0,0,0,0.08);
        gap: 0;
    }
    .nav-menu.active {
        left: 0;
    }
    .nav-menu li {
        padding: 14px 0;
    }
    .hamburger {
        display: flex;
    }
    .hamburger.active .bar:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }
    .hamburger.active .bar:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }
    .result-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .result-actions {
        width: 100%;
        justify-content: flex-start;
    }
    .section-header h2 {
        font-size: 1.8rem;
    }
    .keyword-cloud {
        width: 240px;
        height: 240px;
    }
}

@media (max-width: 480px) {
    .hero-text h1 {
        font-size: 1.8rem;
    }
    .generator-card {
        padding: 20px;
    }
    .btn-sm {
        font-size: 0.75rem;
        padding: 6px 10px;
    }
    .keyword-list {
        max-height: 300px;
    }
}