:root {
    --primary-color: #FF6B35;
    --secondary-color: #004E89;
    --accent-color: #FFD166;
    --dark-color: #2B2D42;
    --light-color: #F8F9FA;
    --success-color: #06D6A0;
    --error-color: #EF476F;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
}

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

body {
    font-family: 'Noto Sans SC', 'Poppins', sans-serif;
    background: linear-gradient(135deg, #FFF5F0 0%, #F0F8FF 100%);
    color: var(--dark-color);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* 导航栏 */
.navbar {
    background: white;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo {
    font-size: 2rem;
}

.nav-brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* 英雄区 */
.hero {
    padding: 6rem 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.08'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.95;
}

.hero-btn {
    display: inline-block;
    background: white;
    color: var(--primary-color);
    padding: 1rem 2.5rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.hero-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* 通用样式 */
.section-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 2rem;
    text-align: center;
}

.section-title i {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

/* 浏览区 */
.gallery-section {
    padding: 4rem 0;
}

.search-container {
    max-width: 500px;
    margin: 0 auto 1.5rem;
    position: relative;
}

.search-container input {
    width: 100%;
    padding: 1rem 3rem 1rem 1.5rem;
    border: 2px solid #E0E0E0;
    border-radius: 50px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.search-container input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.1);
}

.search-container i {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

/* 分类筛选 */
.category-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.category-btn {
    padding: 0.5rem 1.25rem;
    border: 2px solid #E0E0E0;
    background: white;
    color: var(--dark-color);
    border-radius: 50px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.category-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.category-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.category-count {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* 表情包数量 */
.meme-count {
    text-align: center;
    color: #666;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.meme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

.meme-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    cursor: pointer;
}

.meme-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.meme-image-wrapper {
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: #f5f5f5;
}

.meme-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.meme-card:hover img {
    transform: scale(1.05);
}

.meme-card-content {
    padding: 1rem;
}

.meme-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.meme-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.tag {
    background: var(--light-color);
    color: #666;
    padding: 0.25rem 0.5rem;
    border-radius: 20px;
    font-size: 0.75rem;
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
}

.loading i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* 生成区 */
.generator-section {
    padding: 4rem 0;
}

.back-btn {
    background: var(--light-color);
    color: var(--dark-color);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: #E0E0E0;
}

.generator-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.preview-card, .config-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.preview-card h3, .config-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.preview-container {
    background: #f5f5f5;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#memePreview {
    max-width: 100%;
    height: auto;
}

.upload-item {
    margin-bottom: 1rem;
}

.upload-item label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.upload-zone {
    border: 2px dashed #ccc;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(255, 107, 53, 0.05);
}

.upload-zone i {
    font-size: 2.5rem;
    color: #999;
    margin-bottom: 0.5rem;
}

.upload-zone input {
    display: none;
}

.upload-preview {
    margin-top: 1rem;
    max-width: 100px;
    max-height: 100px;
    border-radius: 8px;
}

.text-item {
    margin-bottom: 1rem;
}

.text-item label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.text-item input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #E0E0E0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.text-item input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.generate-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color), #FF8A5C);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 结果区 */
.result-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    text-align: center;
}

.result-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.result-container {
    margin-bottom: 1.5rem;
}

#resultImage {
    max-width: 100%;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.download-btn {
    background: linear-gradient(135deg, var(--success-color), #08E0A8);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* 页脚 */
.footer {
    background: var(--dark-color);
    color: white;
    padding: 2rem 0;
    text-align: center;
    margin-top: 4rem;
}

/* 响应式 */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .generator-container {
        grid-template-columns: 1fr;
    }
    
    .meme-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
    }
}
