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

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

header {
    text-align: center;
    padding: 3rem 0 2rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

main {
    padding: 2rem 0;
}

/* アップロードエリア */
.upload-section {
    max-width: 600px;
    margin: 0 auto;
}

.upload-area {
    background: var(--bg-primary);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    background-color: rgba(99, 102, 241, 0.05);
}

.upload-icon {
    width: 64px;
    height: 64px;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.upload-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.upload-subtext {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.upload-link {
    color: var(--primary-color);
    text-decoration: underline;
}

.file-types {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* プレビューセクション */
.preview-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

@media (max-width: 768px) {
    .preview-section {
        grid-template-columns: 1fr;
    }
}

.image-container {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: var(--shadow);
}

.image-container img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

.palette-container {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.palette-container h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

/* カラーパレット */
.color-palette {
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
}

.color-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.color-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.color-swatch {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.color-info {
    flex: 1;
}

.color-value {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: color 0.2s ease;
    margin-bottom: 0.25rem;
}

.color-value:hover {
    color: var(--primary-color);
}

.color-frequency {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.copy-btn:hover {
    background: var(--primary-color);
    color: white;
}

.copy-btn svg {
    width: 20px;
    height: 20px;
}

/* エクスポートセクション */
.export-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.export-section h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.export-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
}

.export-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.export-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* リセットセクション */
.reset-section {
    text-align: center;
    margin-top: 2rem;
}

.reset-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reset-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* トースト通知 */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--text-primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

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

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--error-color);
}

.toast.warning {
    background: var(--warning-color);
}

/* フッター */
footer {
    background: var(--bg-primary);
    padding: 2rem 0;
    text-align: center;
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
}

footer p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* レスポンシブ */
@media (max-width: 640px) {
    h1 {
        font-size: 2rem;
    }
    
    .upload-area {
        padding: 3rem 1.5rem;
    }
    
    .palette-container {
        padding: 1.5rem;
    }
    
    .color-item {
        flex-wrap: wrap;
    }
    
    .color-swatch {
        width: 50px;
        height: 50px;
    }
    
    .export-buttons {
        grid-template-columns: 1fr 1fr;
    }
}