.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(5px);
    z-index: 100000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeInModal 0.2s ease-out;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-box {
    background: var(--bg-panel);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUpModal 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpModal {
    from { transform: translateY(20px) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-lighter);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-pure);
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.modal-footer.centered-footer {
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    border-top: 1px solid var(--border-lighter);
}

.setup-group label {
    display: block;
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.setup-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-pure);
    padding: 10px 15px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
    box-sizing: border-box;
}

.setup-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.5);
}

.toggle-group {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.toggle-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 10px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn .btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-btn:hover { color: var(--text-pure); }
.toggle-btn.active {
    background: #38bdf8;
    color: #0f172a;
    box-shadow: 0 2px 8px rgba(56, 189, 248, 0.4);
}

.btn-play {
    background: #38bdf8;
    color: #0f172a;
    border: none;
    padding: 14px 40px;
    border-radius: 8px;
    font-weight: 900;
    font-size: 1.1rem;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
    transition: all 0.2s;
}

.btn-play:hover {
    background: #0284c7;
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.4);
}

.color-group {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.color-btn {
    width: 75px;
    height: 75px;
    border-radius: 12px;
    background: var(--border-lighter);
    border: 2px solid transparent;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
    padding: 10px;
}

.color-btn:hover { background: rgba(255, 255, 255, 0.1); }
.color-btn.active {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.1);
}

.king-icon {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0px 4px 6px rgba(0, 0, 0, 0.4));
}

.sliders-container {
    margin-top: 15px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    padding: 15px;
    border: 1px solid var(--border-lighter);
}

.slider-row { margin-bottom: 15px; }
.slider-row:last-child { margin-bottom: 0; }

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.85rem;
}
.slider-labels .lbl { color: var(--text-dim); }
.slider-labels .val { color: var(--primary); font-weight: bold; font-family: monospace; }
.slider-row input[type="range"] { width: 100%; accent-color: var(--primary); cursor: pointer; }

.cp-color-picker-group {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.cp-color-swatch {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.2);
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    flex-shrink: 0;
    transition: transform 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
}

.cp-color-swatch:hover {
    transform: scale(1.1);
    border-color: var(--primary);
}

.cp-color-area {
    position: relative;
    width: 100%;
    height: 140px;
    cursor: crosshair;
}

.cp-color-picker-cursor {
    width: 16px;
    height: 16px;
    border: 2.5px solid white;
    border-radius: 50%;
    position: absolute;
    pointer-events: none;
    box-shadow: 0 0 5px rgba(0,0,0,0.8), inset 0 0 2px rgba(0,0,0,0.5);
    transform: translate(-50%, -50%);
    z-index: 50;
}

.cp-hue-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: transparent;
    outline: none;
    margin: 15px 0;
    padding: 0;
}

.cp-hue-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 12px;
    cursor: pointer;
    background: linear-gradient(to right, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
    border-radius: 6px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
    border: none;
}

.cp-hue-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #111827;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
    margin-top: -6px;
}

.cp-hue-slider::-moz-range-track {
    width: 100%;
    height: 12px;
    cursor: pointer;
    background: linear-gradient(to right, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
    border-radius: 6px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
    border: none;
}

.cp-hue-slider::-moz-range-thumb {
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #111827;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.cp-hex-input {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-lighter);
    color: var(--text-pure);
    text-align: center;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 900;
    letter-spacing: 2px;
    padding: 10px;
    border-radius: 8px;
    outline: none;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.cp-hex-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
    background: rgba(0, 0, 0, 0.6);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .3s;
    border-radius: 34px;
}

.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .slider {
    background-color: var(--primary);
}

.toggle-switch input:checked + .slider:before {
    transform: translateX(20px);
}