.rgb-hex-wrapper .tool-card {
    background: #ffffff;
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    border-top: 4px solid var(--primary) !important;
}

.rgb-hex-wrapper h1 {
    font-size: 2.25rem;
    color: var(--primary-dark);
    text-align: center;
    margin-bottom: 0.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.converter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
    margin-top: 2rem;
}

/* Left Panel: Sliders */
.input-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.color-slider-group {
    background: var(--gray-100);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.slider-header label {
    font-weight: 700;
    color: var(--text);
    font-size: 0.95rem;
}

.slider-header input[type="number"] {
    width: 70px;
    padding: 0.35rem;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    text-align: center;
    font-weight: 600;
    font-family: 'Inter', monospace;
    outline: none;
    transition: var(--transition);
}

.slider-header input[type="number"]:focus {
    border-color: var(--primary);
}

/* Range Sliders */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    outline: none;
    background: #e2e8f0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--text-light);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Colored Slider tracks & thumbs */
.group-red input[type="range"]::-webkit-slider-thumb { border-color: #ef4444; }
.group-green input[type="range"]::-webkit-slider-thumb { border-color: #10b981; }
.group-blue input[type="range"]::-webkit-slider-thumb { border-color: #3b82f6; }
.group-alpha input[type="range"]::-webkit-slider-thumb { border-color: #64748b; }

.group-red input[type="range"] { background: linear-gradient(to right, #fee2e2, #ef4444); }
.group-green input[type="range"] { background: linear-gradient(to right, #d1fae5, #10b981); }
.group-blue input[type="range"] { background: linear-gradient(to right, #dbeafe, #3b82f6); }
.group-alpha input[type="range"] { background: linear-gradient(to right, #f1f5f9, #94a3b8); }

/* Right Panel: Output & Preview */
.preview-box {
    width: 100%;
    height: 180px;
    border-radius: var(--radius);
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 1rem;
    transition: background-color 0.1s ease;
    border: 1px solid var(--gray-200);
    /* Checkboard pattern for alpha transparency preview */
    background-image: linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    position: relative;
}

.preview-box::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: inherit;
    border-radius: inherit;
}

.contrast-check {
    position: relative;
    z-index: 10;
    display: flex;
    gap: 1.5rem;
    background: rgba(128, 128, 128, 0.4);
    backdrop-filter: blur(5px);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.contrast-check span {
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

.contrast-check span.active {
    opacity: 1;
    text-shadow: 0px 1px 3px rgba(0,0,0,0.3);
}

.copy-input-group {
    display: flex;
    align-items: stretch;
}

.copy-input-group input {
    flex-grow: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-200);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    font-family: 'Inter', monospace;
    font-weight: 600;
    color: var(--text);
    background: var(--gray-100);
    outline: none;
}

.hex-output-box input {
    font-size: 1.25rem;
    letter-spacing: 1px;
    color: var(--primary-dark);
}

.btn-copy {
    background: var(--white);
    border: 1px solid var(--gray-200);
    padding: 0.75rem 1.25rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

/* History */
.history-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.history-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    transition: transform 0.2s ease;
    /* For transparency */
    background-image: linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
    position: relative;
}

.history-swatch::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: inherit;
    border-radius: inherit;
}

.history-swatch:hover {
    transform: scale(1.15);
}

/* Toast */
#copyMessageBox {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 1rem 2rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    transform: translateY(150%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
}
#copyMessageBox.show {
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
    .converter-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}