.cpg-section {
    --tool-accent: #6366F1;
    --tool-accent-rgb: 99, 102, 241;
}

/* ── Options bar ─────────────────────────────────────────────────────────── */
.cpg-options {
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.cpg-base-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.cpg-base-input {
    width: 36px;
    height: 36px;
    border: 1px solid var(--tool-border);
    border-radius: var(--tool-radius-sm);
    padding: 2px;
    cursor: pointer;
    background: none;
    flex-shrink: 0;
}

.cpg-base-hex-input {
    width: 88px;
    height: 36px;
    border: 1px solid var(--tool-border);
    border-radius: var(--tool-radius-sm);
    padding: 0 0.5rem;
    font-family: var(--tool-font-mono);
    font-size: 0.875rem;
    background: var(--tool-surface);
    color: var(--tool-text-primary);
    text-transform: uppercase;
}

.cpg-base-hex-input:focus {
    outline: none;
    border-color: var(--tool-accent);
}

/* ── Palette ─────────────────────────────────────────────────────────────── */
.cpg-palette {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    min-height: 160px;
}

@media (max-width: 640px) {
    .cpg-palette {
        flex-direction: column;
    }

    .cpg-swatch {
        flex: 1 0 auto !important;
        min-height: 90px !important;
    }
}

/* ── Swatch ──────────────────────────────────────────────────────────────── */
.cpg-swatch {
    flex: 1;
    border-radius: var(--tool-radius-md);
    min-height: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 0.75rem 0.5rem;
    position: relative;
    cursor: pointer;
    transition: transform 0.15s, flex 0.2s;
}

.cpg-swatch:hover {
    transform: translateY(-4px);
}

/* Lock button */
.cpg-swatch-lock {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.35);
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9375rem;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
    z-index: 2;
}

.cpg-swatch:hover .cpg-swatch-lock {
    opacity: 1;
}

.cpg-swatch-lock--on {
    opacity: 1 !important;
    background: rgba(99, 102, 241, 0.85);
    color: #fff;
}

/* Info box at bottom of swatch */
.cpg-swatch-info {
    background: rgba(0, 0, 0, 0.45);
    border-radius: 6px;
    padding: 0.25rem 0.5rem 0.3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    width: calc(100% - 1rem);
}

.cpg-swatch-row {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.cpg-swatch-picker {
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 4px;
    padding: 1px;
    cursor: pointer;
    background: none;
    flex-shrink: 0;
}

.cpg-swatch-hex {
    font-family: var(--tool-font-mono);
    font-size: 0.9375rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Editable hex on swatch */
.cpg-swatch-hex-input {
    font-family: var(--tool-font-mono);
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
    outline: none;
    width: 7ch;
    text-align: center;
    cursor: text;
    padding: 0;
}

.cpg-swatch-hex-input:focus {
    border-bottom-color: rgba(255, 255, 255, 0.9);
    color: #fff;
}

.cpg-swatch-copy {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.cpg-swatch-copy:hover {
    color: #fff;
}

/* ── Export area ─────────────────────────────────────────────────────────── */
.cpg-export-wrap {
    margin-top: 0.5rem;
}

/* Format tabs */
.cpg-format-tabs {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.cpg-format-tab {
    padding: 0.25rem 0.625rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border: 1px solid var(--tool-border);
    border-radius: var(--tool-radius-sm);
    background: transparent;
    color: var(--tool-text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.cpg-format-tab:hover {
    border-color: var(--tool-accent);
    color: var(--tool-accent);
}

.cpg-format-tab--active {
    background: var(--tool-accent);
    border-color: var(--tool-accent);
    color: #fff;
}

.cpg-output-ta {
    font-family: var(--tool-font-mono);
    font-size: 0.9375rem;
    min-height: 120px;
    max-height: 200px;
    resize: vertical;
}