.cp {
    display: grid;
    gap: 10px;
    width: 100%;
    max-width: 260px;
}

.cp-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.cp-square {
    --cp-hue: #ff0000;
    position: relative;
    height: 150px;
    border-radius: 8px;
    background:
        linear-gradient(to top, #000, transparent),
        linear-gradient(to right, #fff, transparent),
        var(--cp-hue);
    cursor: crosshair;
    touch-action: none;
}

.cp-square:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.cp-thumb {
    position: absolute;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgb(0 0 0 / 0.5), 0 1px 3px rgb(0 0 0 / 0.4);
    pointer-events: none;
}

.cp-hue {
    width: 100%;
    height: 14px;
    margin: 0;
    border-radius: 7px;
    appearance: none;
    background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
    cursor: pointer;
}

.cp-hue::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: transparent;
    box-shadow: 0 0 0 1px rgb(0 0 0 / 0.5);
}

.cp-hue::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: transparent;
    box-shadow: 0 0 0 1px rgb(0 0 0 / 0.5);
}

.cp-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cp-preview {
    width: 32px;
    height: 32px;
    flex: none;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.cp-hex {
    width: 7.5em;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    text-transform: uppercase;
}

.cp-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cp-swatch {
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
}

.cp-swatch:hover {
    transform: scale(1.12);
}

.cp-panel {
    display: grid;
    gap: 10px;
}

.cp-panel[hidden] {
    display: none;
}

.cp-modes {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    justify-self: start;
}

.cp-mode {
    padding: 4px 10px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.cp-mode + .cp-mode {
    border-left: 1px solid var(--border);
}

.cp-mode[aria-pressed="true"] {
    background: var(--accent);
    color: var(--accent-text);
}

.cp-channel {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cp-channel-name {
    width: 1em;
    font-weight: 600;
}

.cp-channel-slider {
    flex: 1;
    min-width: 0;
    height: 14px;
    margin: 0;
    border-radius: 7px;
    appearance: none;
    cursor: pointer;
}

.cp-channel-slider::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: transparent;
    box-shadow: 0 0 0 1px rgb(0 0 0 / 0.5);
}

.cp-channel-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: transparent;
    box-shadow: 0 0 0 1px rgb(0 0 0 / 0.5);
}

.cp-channel-number {
    width: 4.2em;
}
