/* ========================================
   Color From Image — Clean Light Theme
   ======================================== */
:root {
    --primary: #6366F1;
    --primary-hover: #4F46E5;
    --bg: #FAFAFA;
    --bg-card: #FFFFFF;
    --border: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(99, 102, 241, 0.3);
    --text: #1F2937;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --radius: 12px;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --font: 'Inter', -apple-system, sans-serif;
    --transition: 0.2s ease;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.app {
    max-width: 860px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

.header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.logo-icon {
    font-size: 1.5rem;
}

.logo h1 {
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #6366F1, #EC4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* Upload */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    background: var(--bg-card);
    transition: all var(--transition);
}

.upload-zone:hover,
.upload-zone:focus-visible {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.1);
}

.upload-zone.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.03);
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.upload-zone p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.browse {
    color: var(--primary);
    text-decoration: underline;
    cursor: pointer;
}

.upload-hint {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.3rem;
}

/* Editor */
.preview-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-top: 1rem;
}

.image-preview {
    border-radius: var(--radius);
    overflow: hidden;
    background: #F3F4F6;
    box-shadow: var(--shadow);
}

.image-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.palette-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.palette-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.palette-header h2 {
    font-size: 1rem;
    font-weight: 700;
}

.palette-actions {
    display: flex;
    gap: 0.3rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    font-family: var(--font);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

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

.btn-sm {
    padding: 0.3rem 0.55rem;
}

.swatches {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.swatch {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow);
}

.swatch:hover {
    border-color: var(--border-hover);
    transform: translateX(4px);
}

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

.swatch-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.swatch-hex {
    font-size: 0.85rem;
    font-weight: 700;
    font-family: monospace;
}

.swatch-rgb {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: monospace;
}

.swatch-pct {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.gradient-preview {
    height: 40px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    background: linear-gradient(90deg, #ccc, #999);
}

.contrast-info {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 0.55rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 100;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.hidden {
    display: none !important;
}

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

    .swatch-color {
        width: 36px;
        height: 36px;
    }
}