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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 2.5em;
}

h2 {
    color: #555;
    margin-bottom: 20px;
    text-align: center;
}

#loading {
    text-align: center;
    font-size: 1.2em;
    color: #667eea;
    margin: 20px 0;
}

/* 밈 그리드 */
#meme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.meme-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.meme-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    background: #e9ecef;
}

.meme-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
}

.meme-card p {
    text-align: center;
    font-size: 0.9em;
    color: #333;
    font-weight: 500;
}

/* 편집 섹션 */
#edit-section {
    animation: fadeIn 0.5s ease-in;
}

.selected-meme {
    text-align: center;
    margin-bottom: 30px;
}

.selected-meme img {
    max-width: 400px;
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    margin-bottom: 15px;
}

.selected-meme p {
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.input-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
}

.button-group {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

button {
    padding: 12px 30px;
    font-size: 1em;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#generate-btn, #download-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

#generate-btn:hover, #download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

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

#back-btn, #new-meme-btn {
    background: #6c757d;
    color: white;
}

#back-btn:hover, #new-meme-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

#generating {
    text-align: center;
    color: #667eea;
    font-size: 1.1em;
    margin-top: 20px;
    font-weight: bold;
}

/* 결과 섹션 */
#result-section {
    animation: fadeIn 0.5s ease-in;
}

#result-container {
    text-align: center;
    margin: 30px 0;
}

#result-img {
    max-width: 600px;
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 2em;
    }

    #meme-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .meme-card img {
        height: 150px;
    }

    .button-group {
        flex-direction: column;
    }

    button {
        width: 100%;
    }
}
