.palette-toggle {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(19, 26, 38, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid #1e293b;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    padding: 0;
}

.palette-toggle:hover {
    background: #131a26;
    border-color: #3b82f6;
}

.palette-toggle.active {
    background: #3b82f6;
    border-color: #3b82f6;
}

.toggle-icon {
    width: 16px;
    height: 16px;
    background: #94a3b8;
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
}

.palette-toggle:hover .toggle-icon {
    background: #f8fafc;
}

.palette-toggle.active .toggle-icon {
    background: #ffffff;
    transform: rotate(180deg);
}

.color-palette {
    position: absolute;
    bottom: 75px;
    right: 20px;
    background: rgba(19, 26, 38, 0.9);
    backdrop-filter: blur(15px);
    border: 1px solid #1e293b;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10;
    transition: opacity 0.2s, transform 0.2s;
    transform-origin: bottom right;
}

.color-palette.closed {
    opacity: 0;
    transform: scale(0.9) translateY(10px);
    pointer-events: none;
}

.palette-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
}

.color-dot.active {
    border-color: #ffffff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.custom-color-wrapper {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    border: 1px solid #334155;
}

#custom-color-picker {
    position: absolute;
    top: -5px;
    left: -5px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    background: transparent;
    border: none;
}

.palette-divider {
    height: 1px;
    background: #1e293b;
    width: 100%;
}

.vertical-divider {
    width: 1px;
    background: #1e293b;
    height: 20px;
}

.shape-selector {
    display: flex;
    gap: 6px;
}

.shape-btn {
    background: transparent;
    border: 1px solid #1e293b;
    color: #64748b;
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 11px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.shape-btn:hover {
    background: #0b0f19;
    color: #94a3b8;
    border-color: #334155;
}

.shape-btn.active {
    background: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 4px;
}

.slider-label {
    font-size: 9px;
    color: #475569;
    font-weight: bold;
    margin-right: 2px;
}

.slider-sign {
    font-size: 10px;
    color: #475569;
}

.time-slider-wrapper, .count-slider-wrapper, .size-slider-wrapper, .speed-slider-wrapper, .opacity-slider-wrapper {
    width: 45px;
    display: flex;
    align-items: center;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: #1e293b;
    height: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 7px;
    height: 7px;
    background: #3b82f6;
    cursor: pointer;
    transition: background 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #60a5fa;
}

.music-box {
    position: absolute;
    top: 65px;
    left: 150px;
    background: rgba(19, 26, 38, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid #1e293b;
    padding: 18px;
    width: 310px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 10;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    transition: opacity 0.2s, transform 0.2s;
    transform-origin: top left;
}

.music-box.closed {
    opacity: 0;
    transform: scale(0.9) translateY(-10px);
    pointer-events: none;
}

.music-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.music-panel-title {
    font-size: 11px;
    color: #64748b;
    font-weight: bold;
    letter-spacing: 1px;
}

.playlist-container {
    max-height: 140px;
    overflow-y: auto;
    background: #0b0f19;
    border: 1px solid #1e293b;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.no-tracks-hint {
    font-size: 11px;
    color: #475569;
    text-align: center;
    padding: 16px 0;
}

.track-item {
    font-size: 12px;
    color: #94a3b8;
    padding: 6px 8px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s, color 0.15s;
}

.track-item:hover {
    background: #131a26;
    color: #f8fafc;
}

.track-item.active {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.15);
    font-weight: bold;
}

.music-upload-btn {
    background: #1e293b;
    color: #cbd5e1;
    font-size: 11px;
    text-align: center;
    padding: 8px;
    cursor: pointer;
    font-weight: bold;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.music-upload-btn:hover {
    background: #334155;
    color: #ffffff;
    border-color: #475569;
}

.music-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.music-ctrl-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #3b82f6;
    border: none;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.music-ctrl-btn:hover:not(:disabled) {
    background: #2563eb;
}

.music-ctrl-btn:disabled {
    background: #1e293b;
    color: #475569;
    cursor: not-allowed;
}

.music-volume-container {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    justify-content: flex-end;
}

.music-sign {
    font-size: 12px;
    color: #64748b;
    font-weight: bold;
}

.volume-slider-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
}

.music-option-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.music-option-row label {
    color: #cbd5e1;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
}

.music-option-row input[type="checkbox"] {
    cursor: pointer;
    accent-color: #3b82f6;
}

.gradient-toggle-btn {
    background: transparent;
    border: 1px solid #1e293b;
    color: #64748b;
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.gradient-toggle-btn:hover {
    background: #0b0f19;
    color: #94a3b8;
    border-color: #334155;
}

.gradient-toggle-btn.active {
    background: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}

.gradient-system-wrapper {
    position: relative;
}

.gradient-popover {
    position: absolute;
    bottom: 35px;
    right: 0;
    background: #131a26;
    border: 1px solid #1e293b;
    padding: 10px;
    width: 170px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 20;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.gradient-popover.closed {
    display: none !important;
}

.gradient-popover-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 9px;
    color: #475569;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.gradient-add-btn {
    background: transparent;
    border: none;
    color: #3b82f6;
    cursor: pointer;
    font-size: 11px;
    padding: 0;
}

.gradient-add-btn:hover {
    color: #2563eb;
}

.gradient-pickers-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 170px;
    overflow-y: auto;
}

.gradient-row-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #0b0f19;
    padding: 4px 6px;
    border: 1px solid #1e293b;
}

.gradient-color-input {
    width: 16px;
    height: 16px;
    border: 1px solid #334155;
    background: transparent;
    cursor: pointer;
    padding: 0;
}

.gradient-remove-btn {
    background: transparent;
    border: none;
    color: #475569;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    width: auto;
}

.gradient-remove-btn:hover {
    color: #ef4444;
}

.gradient-popover-footer {
    display: flex;
    justify-content: flex-end;
}

.gradient-apply-btn {
    font-size: 9px;
    padding: 4px 10px;
    width: auto;
}

.brush-selector-popover {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
    width: auto;
}

.brush-btn {
    width: 60px;
    height: 30px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
}

.brush-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.brush-btn.active {
    background: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}