/* Palette panel (bottom-right) */
#palette-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#palette-grid {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    gap: 1px;
    align-content: start;
}

.palette-swatch {
    aspect-ratio: 1;
    border: 1px solid var(--border);
    cursor: pointer;
    min-width: 0;
    position: relative;
}

.palette-swatch:hover {
    border-color: var(--text);
    z-index: 1;
}

.palette-swatch.fg-selected {
    border: 2px solid var(--text-bright);
    z-index: 2;
}

.palette-swatch.bg-selected {
    border: 2px dashed var(--text);
    z-index: 2;
}

/* Palette color editor (inline) */
#palette-editor {
    padding: 8px;
    border-top: 1px solid var(--border);
    display: none;
}

#palette-editor.visible {
    display: block;
}

#palette-editor .editor-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

#palette-editor label {
    width: 14px;
    font-size: 11px;
    color: var(--text-dim);
    font-weight: 600;
}

#palette-editor input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-input);
    border-radius: 2px;
    outline: none;
}

#palette-editor input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}

#palette-editor input[type="number"] {
    width: 44px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 2px;
    color: var(--text);
    font-size: 11px;
    padding: 2px 4px;
    text-align: center;
}

#palette-editor input[type="number"]:focus {
    border-color: var(--accent);
    outline: none;
}

#palette-editor-preview {
    width: 100%;
    height: 24px;
    border: 1px solid var(--border);
    margin-bottom: 6px;
}

#palette-editor-index {
    font-size: 11px;
    color: var(--text-dim);
    text-align: center;
    margin-bottom: 4px;
}
