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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

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

header {
    text-align: center;
    margin-bottom: 3rem;
    color: #fff;
}

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

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

main {
    display: grid;
    gap: 2rem;
}

section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #333;
}

h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #555;
}

/* アップロードエリア */
.upload-area {
    border: 3px dashed #cbd5e0;
    border-radius: 12px;
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: #667eea;
    background: #f0f4ff;
}

.upload-icon {
    width: 64px;
    height: 64px;
    color: #667eea;
    margin-bottom: 1rem;
}

.upload-text {
    font-size: 1.1rem;
    color: #64748b;
}

/* コントロール */
.controls-section,
.preview-section,
.emoji-palette {
    display: none;
}

.controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-weight: 500;
    color: #333;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #764ba2;
}

select {
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

select:focus {
    outline: none;
    border-color: #667eea;
}

input[type="color"] {
    width: 100%;
    height: 50px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
}

input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 0.5rem;
    cursor: pointer;
}

/* ボタン */
.generate-btn,
.action-btn {
    padding: 1rem 2rem;
    background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.generate-btn:hover,
.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.action-btn.secondary {
    background: #64748b;
}

.action-btn.secondary:hover {
    background: #475569;
    box-shadow: 0 10px 20px rgba(100, 116, 139, 0.3);
}

/* プレビュー */
.preview-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.preview-box {
    text-align: center;
}

canvas {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: #f8f9fa;
}

.progress-bar {
    display: none;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    margin-top: 1rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s ease;
}

.actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* 絵文字パレット */
.emoji-palette {
    background: #f8f9fa;
}

.emoji-grid {
    display: grid;
    gap: 1.5rem;
}

.emoji-group h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: #64748b;
    text-transform: capitalize;
}

.emoji-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.emoji-btn {
    width: 48px;
    height: 48px;
    font-size: 24px;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.emoji-btn:hover {
    transform: scale(1.1);
    border-color: #667eea;
}

.emoji-btn.selected {
    border-color: #667eea;
    background: #f0f4ff;
}

/* スタイルグリッド */
.style-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.style-btn {
    padding: 1rem;
    background: #f8f9fa;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.style-btn:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateY(-2px);
}

/* フッター */
footer {
    text-align: center;
    margin-top: 3rem;
    padding: 2rem 0;
    color: #fff;
}

footer a {
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    transition: border-color 0.3s ease;
}

footer a:hover {
    border-color: #fff;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .preview-container {
        grid-template-columns: 1fr;
    }
    
    .controls {
        grid-template-columns: 1fr;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
    }
}